#[repr(transparent)]
pub struct Pointer<'a, T>(pub Value, _);
Expand description

A handle to a Rust value/reference owned by the OCaml heap.

This should only be used with values allocated with alloc_final or alloc_custom, for abstract pointers see Value::alloc_abstract_ptr and Value::abstract_ptr_val

Tuple Fields

0: Value

Implementations

Allocate a new value with an optional custom finalizer and used/max

This calls caml_alloc_final under-the-hood, which can has less than ideal performance behavior. In most cases you should prefer Poiner::alloc_custom when possible.

Allocate a Custom value

Drop pointer in place

Safety

This should only be used when you’re in control of the underlying value and want to drop it. It should only be called once.

Replace the inner value with the provided argument

Access the underlying pointer

Access the underlying mutable pointer

Trait Implementations

Converts this type into a mutable reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Convert from OCaml value

Convert to OCaml value

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.