about summary refs log tree commit diff
path: root/tvix/eval/src/value/string.rs
blob: d4776caea40385a0ded7b562fed31605b7f37878 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use std::fmt::Display;

/// This module implements Nix language strings and their different
/// backing implementations.

#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct NixString(pub String);

impl Display for NixString {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.0.as_str())
    }
}

impl From<&str> for NixString {
    fn from(s: &str) -> Self {
        NixString(s.to_string())
    }
}