Struct NixCExternalValueDesc

Source
#[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

nix_create_external_value

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_value
  • printer [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_value
  • res [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_value
  • res [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_value
  • c [out] - writable string context for the resulting string
  • coerceMore [in] - boolean, try to coerce to strings in more cases instead of throwing an error
  • copyToStore [in] - boolean, whether to copy referenced paths to store or keep them as-is
  • res [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_value
  • other [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_value
  • state [in] - The evaluator state
  • strict [in] - boolean Whether to force the value before printing
  • c [out] - writable string context for the resulting string
  • copyToStore [in] - whether to copy referenced paths to store or keep them as-is
  • res [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_value
  • state [in] - The evaluator state
  • strict [in] - boolean Whether to force the value before printing
  • location [in] - boolean Whether to include position information in the xml
  • doc [out] - XML document to output to
  • c [out] - writable string context for the resulting string
  • drvsSeen [in,out] - a path set to avoid duplicating derivations
  • pos [in] - The position of the call.

Trait Implementations§

Source§

impl Clone for NixCExternalValueDesc

Source§

fn clone(&self) -> NixCExternalValueDesc

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NixCExternalValueDesc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for NixCExternalValueDesc

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.