#[repr(transparent)]
pub struct Pointer<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 Custom value

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 new abstract 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

Converts to this type from the input type.

Convert from OCaml value

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

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Convert to OCaml value

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

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.