pub trait NixExternal:
Send
+ Sync
+ 'static {
// Required methods
fn display(&self) -> String;
fn type_name(&self) -> &'static str;
// Provided methods
fn coerce_to_string(&self) -> Option<String> { ... }
fn equal(&self, _other: &Self) -> bool { ... }
}Expand description
A Rust type that can be embedded as an external value in the Nix evaluator.
Implementing this trait is the only requirement for storing your type inside
Nix values via EvalState::make_external. All methods except
display and type_name
have default no-op implementations.
Required Methods§
Provided Methods§
Sourcefn coerce_to_string(&self) -> Option<String>
fn coerce_to_string(&self) -> Option<String>
Try to coerce the value to a string.
Return Some(s) to allow coercion; return None (the default) to have
Nix throw an error when coercion is attempted.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.