pub enum Value {
Show 16 variants
Nil,
Bool(bool),
Int(i64),
Float(f64),
Str(String),
Symbol(String),
Keyword(String),
Path(PathBuf),
List(Arc<Vec<Value>>),
Attrs(Arc<BTreeMap<String, Value>>),
Lambda(Arc<Lambda>),
Builtin(Arc<Builtin>),
Thunk(Arc<Thunk>),
Derivation(Arc<Derivation>),
StorePath(StorePath),
Quoted(Arc<Sexp>),
}Expand description
Every runtime value flows through this enum. Variants match a Nix-ish ontology (atoms, lists, attrsets, functions, thunks, paths, derivations) so the Lisp surface can carry Nix’s academic semantics verbatim.
Variants§
Nil
Bool(bool)
Int(i64)
Float(f64)
Str(String)
Symbol(String)
Keyword(String)
Path(PathBuf)
List(Arc<Vec<Value>>)
Attrs(Arc<BTreeMap<String, Value>>)
Lambda(Arc<Lambda>)
Builtin(Arc<Builtin>)
Thunk(Arc<Thunk>)
Derivation(Arc<Derivation>)
StorePath(StorePath)
Quoted(Arc<Sexp>)
A quoted Sexp — lets Lisp programs manipulate code-as-data.
Implementations§
Source§impl Value
impl Value
pub fn type_name(&self) -> &'static str
pub fn is_truthy(&self) -> bool
pub fn as_int(&self) -> Option<i64>
pub fn as_str(&self) -> Option<&str>
pub fn as_list(&self) -> Option<&[Value]>
pub fn as_attrs(&self) -> Option<&BTreeMap<String, Value>>
pub fn as_derivation(&self) -> Option<&Derivation>
pub fn as_path(&self) -> Option<&PathBuf>
Sourcepub fn coerce_to_string(&self) -> Option<String>
pub fn coerce_to_string(&self) -> Option<String>
Coerce this value to a plain String if that’s a meaningful operation.
Matches Nix’s toString semantics: strings/numbers/paths/derivations
have a canonical string form; lists/attrs/lambdas do not.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Value
impl !UnwindSafe for Value
impl Freeze for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more