Files
nixjit/evaluator/nixjit_eval/src/value/string.rs
2025-08-15 23:14:21 +08:00

39 lines
996 B
Rust

//! Defines a placeholder for Nix's contextful strings.
//!
//! In Nix, strings can carry a "context" which affects how they are
//! handled, particularly with regards to path resolution. This module
//! provides the basic structures for this feature, although it is
//! currently a work in progress.
// TODO: Contextful String
/// Represents the context associated with a string.
pub struct StringContext {
context: Vec<()>,
}
impl StringContext {
/// Creates a new, empty `StringContext`.
pub fn new() -> StringContext {
StringContext {
context: Vec::new(),
}
}
}
/// A string that carries an associated context.
pub struct ContextfulString {
string: String,
context: StringContext,
}
impl ContextfulString {
/// Creates a new `ContextfulString` from a standard `String`.
pub fn new(string: String) -> ContextfulString {
ContextfulString {
string,
context: StringContext::new(),
}
}
}