Struct ocaml_interop::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>

§

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> RefUnwindSafe for BoxRoot<T>
where T: RefUnwindSafe,

§

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>
where T: UnwindSafe,

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.