pub struct PrimOp { /* private fields */ }Implementations§
Source§impl PrimOp
impl PrimOp
Sourcepub fn new<const N: usize>(
meta: PrimOpMeta<'_, N>,
f: Box<dyn Fn(&mut EvalState, &[Value; N]) -> Result<Value>>,
) -> Result<PrimOp>
pub fn new<const N: usize>( meta: PrimOpMeta<'_, N>, f: Box<dyn Fn(&mut EvalState, &[Value; N]) -> Result<Value>>, ) -> Result<PrimOp>
Create a new primop with the given metadata and implementation.
The primop is not tied to an EvalState; the callback argument comes
directly from Nix.
When f returns an Err, the error is propagated to the Nix evaluator.
To return a recoverable error, include it in the
error chain (e.g. Err(RecoverableError::new("...").into())).
Sourcepub fn into_value(self, eval_state: &mut EvalState) -> Result<Value>
pub fn into_value(self, eval_state: &mut EvalState) -> Result<Value>
Sourcepub fn register_globally(self) -> Result<()>
pub fn register_globally(self) -> Result<()>
Registers this primop into future EvalStates.
Per the Nix C API (nix_register_primop), this only affects
EvalStates created after the call.
This fully consumes the PrimOp because the C API leaves it invalid.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PrimOp
impl RefUnwindSafe for PrimOp
impl !Send for PrimOp
impl !Sync for PrimOp
impl Unpin for PrimOp
impl UnsafeUnpin for PrimOp
impl UnwindSafe for PrimOp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more