[−][src]Struct ocaml::Pointer
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
Implementations
impl<T> Pointer<T>
[src]
pub fn alloc_final(
x: T,
finalizer: Option<unsafe extern "C" fn(_: Value)>,
used_max: Option<(usize, usize)>
) -> Pointer<T>
[src]
x: T,
finalizer: Option<unsafe extern "C" fn(_: Value)>,
used_max: Option<(usize, usize)>
) -> Pointer<T>
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.
pub fn alloc_custom(x: T) -> Pointer<T> where
T: Custom,
[src]
T: Custom,
Allocate a Custom
value
pub unsafe fn drop_in_place(self)
[src]
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.
pub fn set(&mut self, x: T)
[src]
Replace the inner value with the provided argument
pub fn as_ptr(&self) -> *const T
[src]
Access the underlying pointer
pub fn as_mut_ptr(&mut self) -> *mut T
[src]
Access the underlying mutable pointer
Trait Implementations
impl<T> AsMut<T> for Pointer<T>
[src]
impl<T> AsRef<T> for Pointer<T>
[src]
impl<T: Clone> Clone for Pointer<T>
[src]
impl<T: Copy> Copy for Pointer<T>
[src]
impl<T> FromValue for Pointer<T>
[src]
fn from_value(value: Value) -> Self
[src]
impl<T: PartialEq> PartialEq<Pointer<T>> for Pointer<T>
[src]
impl<T> StructuralPartialEq for Pointer<T>
[src]
impl<T> ToValue for Pointer<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Pointer<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Pointer<T> where
T: Send,
T: Send,
impl<T> Sync for Pointer<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Pointer<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Pointer<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,