#[repr(C)]pub struct NixCExternalValueDesc {
pub print: Option<unsafe extern "C" fn(self_: *mut c_void, printer: *mut nix_printer)>,
pub showType: Option<unsafe extern "C" fn(self_: *mut c_void, res: *mut nix_string_return)>,
pub typeOf: Option<unsafe extern "C" fn(self_: *mut c_void, res: *mut nix_string_return)>,
pub coerceToString: Option<unsafe extern "C" fn(self_: *mut c_void, c: *mut nix_string_context, coerceMore: c_int, copyToStore: c_int, res: *mut nix_string_return)>,
pub equal: Option<unsafe extern "C" fn(self_: *mut c_void, other: *mut c_void) -> c_int>,
pub printValueAsJSON: Option<unsafe extern "C" fn(self_: *mut c_void, state: *mut EvalState, strict: bool, c: *mut nix_string_context, copyToStore: bool, res: *mut nix_string_return)>,
pub printValueAsXML: Option<unsafe extern "C" fn(self_: *mut c_void, state: *mut EvalState, strict: c_int, location: c_int, doc: *mut c_void, c: *mut nix_string_context, drvsSeen: *mut c_void, pos: c_int)>,
}
Expand description
Definition for a class of external values Create and implement one of these, then pass it to nix_create_external_value Make sure to keep it alive while the external value lives. Optional functions can be set to NULL
§See also
Fields§
§print: Option<unsafe extern "C" fn(self_: *mut c_void, printer: *mut nix_printer)>
Called when printing the external value
§Arguments
self
[in] - the void* passed to nix_create_external_valueprinter
[out] - The printer to print to, pass to nix_external_print
showType: Option<unsafe extern "C" fn(self_: *mut c_void, res: *mut nix_string_return)>
Called on :t
§Arguments
self
[in] - the void* passed to nix_create_external_valueres
[out] - the return value
typeOf: Option<unsafe extern "C" fn(self_: *mut c_void, res: *mut nix_string_return)>
Called on builtins.typeOf
§Arguments
self
- the void* passed to nix_create_external_valueres
[out] - the return value
coerceToString: Option<unsafe extern "C" fn(self_: *mut c_void, c: *mut nix_string_context, coerceMore: c_int, copyToStore: c_int, res: *mut nix_string_return)>
Called on “${str}” and builtins.toString. The latter with coerceMore=true Optional, the default is to throw an error.
§Arguments
self
[in] - the void* passed to nix_create_external_valuec
[out] - writable string context for the resulting stringcoerceMore
[in] - boolean, try to coerce to strings in more cases instead of throwing an errorcopyToStore
[in] - boolean, whether to copy referenced paths to store or keep them as-isres
[out] - the return value. Not touching this, or setting it to the empty string, will make the conversion throw an error.
equal: Option<unsafe extern "C" fn(self_: *mut c_void, other: *mut c_void) -> c_int>
Try to compare two external values Optional, the default is always false. If the other object was not a Nix C external value, this comparison will also return false
§Arguments
self
[in] - the void* passed to nix_create_external_valueother
[in] - the void* passed to the other object’s nix_create_external_value
§Returns
true if the objects are deemed to be equal
printValueAsJSON: Option<unsafe extern "C" fn(self_: *mut c_void, state: *mut EvalState, strict: bool, c: *mut nix_string_context, copyToStore: bool, res: *mut nix_string_return)>
Convert the external value to json Optional, the default is to throw an error
§Arguments
self
[in] - the void* passed to nix_create_external_valuestate
[in] - The evaluator statestrict
[in] - boolean Whether to force the value before printingc
[out] - writable string context for the resulting stringcopyToStore
[in] - whether to copy referenced paths to store or keep them as-isres
[out] - the return value. Gets parsed as JSON. Not touching this, or setting it to the empty string, will make the conversion throw an error.
printValueAsXML: Option<unsafe extern "C" fn(self_: *mut c_void, state: *mut EvalState, strict: c_int, location: c_int, doc: *mut c_void, c: *mut nix_string_context, drvsSeen: *mut c_void, pos: c_int)>
Convert the external value to XML Optional, the default is to throw an error @todo The mechanisms for this call are incomplete. There are no C bindings to work with XML, pathsets and positions.
§Arguments
self
[in] - the void* passed to nix_create_external_valuestate
[in] - The evaluator statestrict
[in] - boolean Whether to force the value before printinglocation
[in] - boolean Whether to include position information in the xmldoc
[out] - XML document to output toc
[out] - writable string context for the resulting stringdrvsSeen
[in,out] - a path set to avoid duplicating derivationspos
[in] - The position of the call.
Trait Implementations§
Source§impl Clone for NixCExternalValueDesc
impl Clone for NixCExternalValueDesc
Source§fn clone(&self) -> NixCExternalValueDesc
fn clone(&self) -> NixCExternalValueDesc
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more