[−][src]Struct ocaml::value::Value
Value wraps the native OCaml value
type
Methods
impl Value
[src]
pub fn alloc(n: usize, tag: Tag) -> Value
[src]
Allocate a new value with the given size and tag
pub fn alloc_small(n: usize, tag: Tag) -> Value
[src]
Allocate a new small value with the given size and tag
pub fn alloc_custom<T>(value: T, finalizer: extern "C" fn(_: Value)) -> Value
[src]
Allocate a new value with a custom finalizer
pub fn set_custom<T>(&mut self, value: T) -> T
[src]
pub fn new(v: Value) -> Value
[src]
Create a new Value from an existing OCaml value
pub fn register_global_root(&self)
[src]
See caml_register_global_root
pub fn remove_global_root(&self)
[src]
Set caml_remove_global_root
pub fn value(&self) -> Value
[src]
Get the underlying OCaml value
pub fn tag(&self) -> Tag
[src]
Get the tag for the underlying OCaml value
pub fn bool(b: bool) -> Value
[src]
Convert a boolean to OCaml value
pub fn some<V: ToValue>(v: V) -> Value
[src]
OCaml Some value
pub fn none() -> Value
[src]
OCaml None value
pub fn variant<V: ToValue>(tag: u8, value: Option<V>) -> Value
[src]
Create a variant value
pub fn ptr<T>(p: *const T) -> Value
[src]
Create a new opaque pointer Value
pub fn i32(i: i32) -> Value
[src]
Create an integer Value from i32
pub fn i64(i: i64) -> Value
[src]
Create an integer Value from i64
pub fn int64(i: i64) -> Value
[src]
Create an OCaml int64 from i64
pub fn int32(i: i32) -> Value
[src]
Create an OCaml int32 from i32
pub fn nativeint(i: isize) -> Value
[src]
Create an OCaml native int from isize
pub fn isize(i: isize) -> Value
[src]
Create a long Value from isize
pub fn usize(u: usize) -> Value
[src]
Create a value from usize
pub fn f64(d: f64) -> Value
[src]
Create a value from f64
pub fn is_block(&self) -> bool
[src]
Check if a Value is an integer or block, returning true if the underlying value is a block
pub fn is_long(&self) -> bool
[src]
Check if a Value is an integer or block, returning true if the underlying value is an integer
pub fn field(&self, i: Size) -> Value
[src]
Get index of underlying OCaml block value
pub fn store_field<V: ToValue>(&mut self, i: Size, val: V)
[src]
Set index of underlying OCaml block value
pub fn i32_val(&self) -> i32
[src]
Convert an OCaml integer to i32
pub fn i64_val(&self) -> i64
[src]
Convert an OCaml integer to i64
pub fn isize_val(&self) -> isize
[src]
Convert an OCaml integer to isize
pub fn usize_val(&self) -> usize
[src]
Convert an OCaml integer to usize
pub fn f64_val(&self) -> f64
[src]
Convert an OCaml float to f64
pub fn int32_val(&self) -> i32
[src]
Convert an OCaml int32 to i32
pub fn int64_val(&self) -> i64
[src]
Convert an OCaml int64 to i64
pub fn nativeint_val(&self) -> isize
[src]
Convert an OCaml integer to isize
pub fn custom_ptr_val<T>(&self) -> *const T
[src]
Get pointer to data stored in an OCaml custom value
pub fn custom_ptr_val_mut<T>(&self) -> *mut T
[src]
Get mutable pointer to data stored in an OCaml custom value
pub fn ptr_val<T>(&self) -> *const T
[src]
Get pointer to data stored in an opaque value
pub fn mut_ptr_val<T>(&self) -> *mut T
[src]
Get mutable pointer to data stored in an opaque value
pub fn call<A: ToValue>(&self, arg: A) -> Result<Value, Error>
[src]
Call a closure with a single argument
pub fn call2<A: ToValue, B: ToValue>(
&self,
arg1: A,
arg2: B
) -> Result<Value, Error>
[src]
&self,
arg1: A,
arg2: B
) -> Result<Value, Error>
Call a closure with two arguments
pub fn call3<A: ToValue, B: ToValue, C: ToValue>(
&self,
arg1: A,
arg2: B,
arg3: C
) -> Result<Value, Error>
[src]
&self,
arg1: A,
arg2: B,
arg3: C
) -> Result<Value, Error>
Call a closure with three arguments
pub fn call_n<A: AsRef<[Value]>>(&self, args: A) -> Result<Value, Error>
[src]
Call a closure with n
arguments
pub fn call_exn<A: ToValue>(&self, arg: A) -> Result<Value, Error>
[src]
Call a closure with a single argument, returning an exception value
pub fn call2_exn<A: ToValue, B: ToValue>(
&self,
arg1: A,
arg2: B
) -> Result<Value, Error>
[src]
&self,
arg1: A,
arg2: B
) -> Result<Value, Error>
Call a closure with two arguments, returning an exception value
pub fn call3_exn<A: ToValue, B: ToValue, C: ToValue>(
&self,
arg1: A,
arg2: B,
arg3: C
) -> Result<Value, Error>
[src]
&self,
arg1: A,
arg2: B,
arg3: C
) -> Result<Value, Error>
Call a closure with three arguments, returning an exception value
pub fn call_n_exn<A: AsRef<[Value]>>(&self, args: A) -> Result<Value, Error>
[src]
Call a closure with n
arguments, returning an exception value
pub fn modify<V: ToValue>(&mut self, v: V)
[src]
Modify an OCaml value in place
pub fn is_exception_result(&self) -> bool
[src]
Determines if the current value is an exception
pub fn method<S: AsRef<str>>(&self, name: S) -> Option<Value>
[src]
Get object method
pub fn deep_clone_to_ocaml(&self) -> Self
[src]
This will recursively clone any OCaml value The new value is allocated inside the OCaml heap, and may end up being moved or garbage collected.
pub fn deep_clone_to_rust(&self) -> Self
[src]
This will recursively clone any OCaml value The new value is allocated outside of the OCaml heap, and should only be used for storage inside Rust structures.
Trait Implementations
impl ToValue for Value
[src]
impl FromValue for Value
[src]
fn from_value(v: Value) -> Value
[src]
impl From<Tuple> for Value
[src]
impl From<Array> for Value
[src]
impl From<Value> for Array
[src]
impl From<List> for Value
[src]
impl From<Value> for List
[src]
impl From<Str> for Value
[src]
impl From<Value> for Str
[src]
impl<T: BigarrayKind> From<Array1<T>> for Value
[src]
impl<T: BigarrayKind> From<Value> for Array1<T>
[src]
impl From<Value> for Value
[src]
impl Clone for Value
[src]
fn clone(&self) -> Value
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Value
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,