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<'_>
impl PrimOpArg<'_>
Sourcepub fn as_attrs(&self) -> Result<ArgAttrs<'_>>
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.
Sourcepub fn as_list(&self) -> Result<ArgList<'_>>
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.