[−][src]Struct ocaml_interop::OCaml
Representation of OCaml values inside ocaml_frame
blocks.
Should not be instantiated directly, and will usually be the result
of ocaml_alloc!
and ocaml_call!
expressions, or the input arguments
of functions defined inside ocaml_export!
blocks.
Implementations
impl<'a, T> OCaml<'a, T>
[src]
pub unsafe fn raw(&self) -> RawOCaml
[src]
Gets the raw representation for this value reference (pointer or int).
Safety
The resulting raw pointer will not be tracked, and may become invalid after any call into the OCaml runtime. Great care must be taken when working with these values.
pub fn keep<'gc>(self, gc: &GCFrame<'gc>) -> OCamlRef<'gc, T>
[src]
Returns a tracked reference to this value.
This method must be used with values that will be referenced after calls into the OCaml runtime have been made.
impl OCaml<'static, ()>
[src]
impl<'a> OCaml<'a, String>
[src]
pub unsafe fn as_bytes(&self) -> &'a [u8]
[src]
pub unsafe fn as_str(&self) -> &'a str
[src]
pub unsafe fn as_str_unchecked(&self) -> &'a str
[src]
impl<'a> OCaml<'a, OCamlBytes>
[src]
pub unsafe fn as_bytes(&self) -> &'a [u8]
[src]
pub unsafe fn as_str(&self) -> &'a str
[src]
pub unsafe fn as_str_unchecked(&self) -> &'a str
[src]
impl<'a> OCaml<'a, OCamlInt>
[src]
pub fn as_i64(&self) -> i64
[src]
Converts an OCaml int to an i64.
pub unsafe fn of_i64(n: i64) -> OCaml<'static, OCamlInt>
[src]
Creates an OCaml int from an i64.
Safety
OCaml ints are represented as 63bits + 1bit tag, so when converting from an i64, a bit of precision is lost.
pub fn of_i32(n: i32) -> OCaml<'static, OCamlInt>
[src]
Creates an OCaml int from an i32.
impl<'a> OCaml<'a, bool>
[src]
pub fn as_bool(self) -> bool
[src]
Converts an OCaml boolean into a Rust boolean.
pub fn of_bool(b: bool) -> Self
[src]
Creates an OCaml boolean from a Rust boolean.
impl<'a, A> OCaml<'a, Option<A>>
[src]
pub fn is_none(&self) -> bool
[src]
Returns true if this OCaml option value is an OCaml None
.
pub fn is_some(&self) -> bool
[src]
Returns true if this OCaml option value is an OCaml Some
.
pub fn to_option(&self) -> Option<OCaml<'a, A>>
[src]
Converts an OCaml Option<T>
value into a Rust Option<OCaml<T>>
.
impl<'a, A, B> OCaml<'a, (A, B)>
[src]
impl<'a, A, B, C> OCaml<'a, (A, B, C)>
[src]
pub fn fst(&self) -> OCaml<'a, A>
[src]
pub fn snd(&self) -> OCaml<'a, B>
[src]
pub fn tuple_3(&self) -> OCaml<'a, C>
[src]
impl<'a, A, B, C, D> OCaml<'a, (A, B, C, D)>
[src]
pub fn fst(&self) -> OCaml<'a, A>
[src]
pub fn snd(&self) -> OCaml<'a, B>
[src]
pub fn tuple_3(&self) -> OCaml<'a, C>
[src]
pub fn tuple_4(&self) -> OCaml<'a, D>
[src]
impl<'a, A> OCaml<'a, OCamlList<A>>
[src]
pub fn nil() -> Self
[src]
Returns an OCaml nil (empty list) value.
pub fn is_empty(&self) -> bool
[src]
Returns true if the value is OCaml's nil (empty list).
pub fn tl(&self) -> Option<OCaml<'a, A>>
[src]
Returns the tail of an OCaml list.
pub fn hd(&self) -> Option<OCaml<'a, A>>
[src]
Returns the head of an OCaml list.
pub fn uncons(&self) -> Option<(OCaml<'a, A>, Self)>
[src]
Returns a tuple of the head and tail of an OCaml list.
Trait Implementations
impl<'a, T: Clone + 'a> Clone for OCaml<'a, T>
[src]
impl<'a, T: Copy + 'a> Copy for OCaml<'a, T>
[src]
impl<'a, T, U> IntoRust<U> for OCaml<'a, T> where
U: FromOCaml<T>,
[src]
U: FromOCaml<T>,
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for OCaml<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T> Send for OCaml<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Sync for OCaml<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Unpin for OCaml<'a, T>
impl<'a, T> UnwindSafe for OCaml<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
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>,