Struct BoxRoot

Source
pub struct BoxRoot<T: 'static> { /* private fields */ }
Expand description

BoxRoot<T> is a container for a rooted OCaml<T> value.

Implementations§

Source§

impl<T> BoxRoot<T>

Source

pub fn new(val: OCaml<'_, T>) -> BoxRoot<T>

Creates a new root from an OCaml<T> value.

Source

pub fn get<'a>(&self, cr: &'a OCamlRuntime) -> OCaml<'a, T>

Gets the value stored in this root as an OCaml<T>.

Source

pub fn keep<'tmp>(&'tmp mut self, val: OCaml<'_, T>) -> OCamlRef<'tmp, T>

Roots the OCaml value val, returning an OCamlRef<T>.

Source§

impl<'c, OCaml1, RetT> BoxRoot<fn(OCaml1) -> RetT>

Source

pub fn try_call<'a, 'b: 'a, arg1, Rust1>( &self, cr: &'c mut OCamlRuntime, arg1: arg1, ) -> Result<OCaml<'c, RetT>, OCaml<'c, OCamlException>>
where arg1: OCamlParam<'a, 'b, Rust1, OCaml1>,

Calls the OCaml closure, converting the arguments to OCaml if necessary

Source§

impl<'c, OCaml1, OCaml2, RetT> BoxRoot<fn(OCaml1, OCaml2) -> RetT>

Source

pub fn try_call<'a, 'b: 'a, arg1, arg2, Rust1, Rust2>( &self, cr: &'c mut OCamlRuntime, arg1: arg1, arg2: arg2, ) -> Result<OCaml<'c, RetT>, OCaml<'c, OCamlException>>
where arg1: OCamlParam<'a, 'b, Rust1, OCaml1>, arg2: OCamlParam<'a, 'b, Rust2, OCaml2>,

Calls the OCaml closure, converting the arguments to OCaml if necessary

Source§

impl<'c, OCaml1, OCaml2, OCaml3, RetT> BoxRoot<fn(OCaml1, OCaml2, OCaml3) -> RetT>

Source

pub fn try_call<'a, 'b: 'a, arg1, arg2, arg3, Rust1, Rust2, Rust3>( &self, cr: &'c mut OCamlRuntime, arg1: arg1, arg2: arg2, arg3: arg3, ) -> Result<OCaml<'c, RetT>, OCaml<'c, OCamlException>>
where arg1: OCamlParam<'a, 'b, Rust1, OCaml1>, arg2: OCamlParam<'a, 'b, Rust2, OCaml2>, arg3: OCamlParam<'a, 'b, Rust3, OCaml3>,

Calls the OCaml closure, converting the arguments to OCaml if necessary

Source§

impl<'c, OCaml1, OCaml2, OCaml3, OCaml4, RetT> BoxRoot<fn(OCaml1, OCaml2, OCaml3, OCaml4) -> RetT>

Source

pub fn try_call<'a, 'b: 'a, arg1, arg2, arg3, arg4, Rust1, Rust2, Rust3, Rust4>( &self, cr: &'c mut OCamlRuntime, arg1: arg1, arg2: arg2, arg3: arg3, arg4: arg4, ) -> Result<OCaml<'c, RetT>, OCaml<'c, OCamlException>>
where arg1: OCamlParam<'a, 'b, Rust1, OCaml1>, arg2: OCamlParam<'a, 'b, Rust2, OCaml2>, arg3: OCamlParam<'a, 'b, Rust3, OCaml3>, arg4: OCamlParam<'a, 'b, Rust4, OCaml4>,

Calls the OCaml closure, converting the arguments to OCaml if necessary

Source§

impl<'c, OCaml1, OCaml2, OCaml3, OCaml4, OCaml5, RetT> BoxRoot<fn(OCaml1, OCaml2, OCaml3, OCaml4, OCaml5) -> RetT>

Source

pub fn try_call<'a, 'b: 'a, arg1, arg2, arg3, arg4, arg5, Rust1, Rust2, Rust3, Rust4, Rust5>( &self, cr: &'c mut OCamlRuntime, arg1: arg1, arg2: arg2, arg3: arg3, arg4: arg4, arg5: arg5, ) -> Result<OCaml<'c, RetT>, OCaml<'c, OCamlException>>
where arg1: OCamlParam<'a, 'b, Rust1, OCaml1>, arg2: OCamlParam<'a, 'b, Rust2, OCaml2>, arg3: OCamlParam<'a, 'b, Rust3, OCaml3>, arg4: OCamlParam<'a, 'b, Rust4, OCaml4>, arg5: OCamlParam<'a, 'b, Rust5, OCaml5>,

Calls the OCaml closure, converting the arguments to OCaml if necessary

Source§

impl<'c, OCaml1, OCaml2, OCaml3, OCaml4, OCaml5, OCaml6, RetT> BoxRoot<fn(OCaml1, OCaml2, OCaml3, OCaml4, OCaml5, OCaml6) -> RetT>

Source

pub fn try_call<'a, 'b: 'a, arg1, arg2, arg3, arg4, arg5, arg6, Rust1, Rust2, Rust3, Rust4, Rust5, Rust6>( &self, cr: &'c mut OCamlRuntime, arg1: arg1, arg2: arg2, arg3: arg3, arg4: arg4, arg5: arg5, arg6: arg6, ) -> Result<OCaml<'c, RetT>, OCaml<'c, OCamlException>>
where arg1: OCamlParam<'a, 'b, Rust1, OCaml1>, arg2: OCamlParam<'a, 'b, Rust2, OCaml2>, arg3: OCamlParam<'a, 'b, Rust3, OCaml3>, arg4: OCamlParam<'a, 'b, Rust4, OCaml4>, arg5: OCamlParam<'a, 'b, Rust5, OCaml5>, arg6: OCamlParam<'a, 'b, Rust6, OCaml6>,

Calls the OCaml closure, converting the arguments to OCaml if necessary

Source§

impl<'c, OCaml1, OCaml2, OCaml3, OCaml4, OCaml5, OCaml6, OCaml7, RetT> BoxRoot<fn(OCaml1, OCaml2, OCaml3, OCaml4, OCaml5, OCaml6, OCaml7) -> RetT>

Source

pub fn try_call<'a, 'b: 'a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, Rust1, Rust2, Rust3, Rust4, Rust5, Rust6, Rust7>( &self, cr: &'c mut OCamlRuntime, arg1: arg1, arg2: arg2, arg3: arg3, arg4: arg4, arg5: arg5, arg6: arg6, arg7: arg7, ) -> Result<OCaml<'c, RetT>, OCaml<'c, OCamlException>>
where arg1: OCamlParam<'a, 'b, Rust1, OCaml1>, arg2: OCamlParam<'a, 'b, Rust2, OCaml2>, arg3: OCamlParam<'a, 'b, Rust3, OCaml3>, arg4: OCamlParam<'a, 'b, Rust4, OCaml4>, arg5: OCamlParam<'a, 'b, Rust5, OCaml5>, arg6: OCamlParam<'a, 'b, Rust6, OCaml6>, arg7: OCamlParam<'a, 'b, Rust7, OCaml7>,

Calls the OCaml closure, converting the arguments to OCaml if necessary

Trait Implementations§

Source§

impl<T> Deref for BoxRoot<T>

Source§

type Target = OCamlCell<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> OCamlRef<'_, T>

Dereferences the value.
Source§

impl<T> Drop for BoxRoot<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T> ToOCaml<T> for BoxRoot<T>

Source§

fn to_ocaml<'a>(&self, cr: &'a mut OCamlRuntime) -> OCaml<'a, T>

Convert to OCaml value.
Source§

fn to_boxroot(&self, cr: &mut OCamlRuntime) -> BoxRoot<T>

Convert to OCaml value. Return an already rooted value as BoxRoot<T>.

Auto Trait Implementations§

§

impl<T> Freeze for BoxRoot<T>

§

impl<T> !RefUnwindSafe for BoxRoot<T>

§

impl<T> !Send for BoxRoot<T>

§

impl<T> !Sync for BoxRoot<T>

§

impl<T> Unpin for BoxRoot<T>
where T: Unpin,

§

impl<T> !UnwindSafe for BoxRoot<T>

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.