Skip to main content

PrimOpArg

Struct PrimOpArg 

Source
pub struct PrimOpArg<'a> { /* private fields */ }
Expand description

A borrowed Nix value passed as an argument to a primop callback.

The value is owned by the Nix evaluator and must not be decreffed by the caller. It is valid only for the duration of the primop invocation (expressed by the 'a lifetime).

Implementations§

Source§

impl PrimOpArg<'_>

Source

pub fn as_attrs(&self) -> Result<ArgAttrs<'_>>

Interpret this argument as an attribute set.

Automatically forces the value if it is a thunk.

Returns an ArgAttrs wrapper that provides read access to the attribute set’s keys and values. The returned wrapper borrows this argument; it does not own any GC references.

§Errors

Returns an error if forcing fails or the resolved value is not an attribute set.

Source

pub fn as_list(&self) -> Result<ArgList<'_>>

Interpret this argument as a list.

Automatically forces the value if it is a thunk.

Returns an ArgList wrapper that provides read access to the list elements. The returned wrapper borrows this argument; it does not own any GC references.

§Errors

Returns an error if forcing fails or the resolved value is not a list.

Auto Trait Implementations§

§

impl<'a> Freeze for PrimOpArg<'a>

§

impl<'a> RefUnwindSafe for PrimOpArg<'a>

§

impl<'a> !Send for PrimOpArg<'a>

§

impl<'a> !Sync for PrimOpArg<'a>

§

impl<'a> Unpin for PrimOpArg<'a>

§

impl<'a> UnsafeUnpin for PrimOpArg<'a>

§

impl<'a> UnwindSafe for PrimOpArg<'a>

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> 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> NixValueOps for T
where T: NixValueRaw,

Source§

fn value_type(&self) -> ValueType

Return the ValueType of this value. Read more
Source§

fn force(&self) -> Result<()>

Force evaluation (resolves thunks). Read more
Source§

fn as_int(&self) -> Result<i64>

Extract as an integer. Forces the value first. Read more
Source§

fn as_float(&self) -> Result<f64>

Extract as a float. Forces the value first. Read more
Source§

fn as_bool(&self) -> Result<bool>

Extract as a boolean. Forces the value first. Read more
Source§

fn as_string(&self) -> Result<String>

Extract as a UTF-8 string, realising any string context. Forces the value first. Read more
Source§

fn as_path(&self) -> Result<String>

Extract as a filesystem-path string. Forces the value first. 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.