Struct ocaml::Array[][src]

#[repr(transparent)]
pub struct Array<'a, T: IntoValue + FromValue<'a>>(_, _);

Array<A> wraps an OCaml 'a array without converting it to Rust

Implementations

impl<'a> Array<'a, f64>[src]

pub fn set_double(&mut self, i: usize, f: f64) -> Result<(), Error>[src]

Set value to double array

pub unsafe fn set_double_unchecked(&mut self, i: usize, f: f64)[src]

Set value to double array without bounds checking

Safety

This function performs no bounds checking

pub fn get_double(&self, i: usize) -> Result<f64, Error>[src]

Get a value from a double array

pub unsafe fn get_double_unchecked(&self, i: usize) -> f64[src]

Get a value from a double array without checking if the array is actually a double array

Safety

This function does not perform bounds checking

impl<'a, T: IntoValue + FromValue<'a>> Array<'a, T>[src]

pub unsafe fn alloc(n: usize) -> Array<'a, T>[src]

Allocate a new Array

pub fn is_double_array(&self) -> bool[src]

Check if Array contains only doubles, if so get_double and set_double should be used to access values

pub fn len(&self) -> usize[src]

Array length

pub fn is_empty(&self) -> bool[src]

Returns true when the array is empty

pub unsafe fn set(&mut self, rt: &Runtime, i: usize, v: T) -> Result<(), Error>[src]

Set array index

pub unsafe fn set_unchecked(&mut self, rt: &Runtime, i: usize, v: T)[src]

Set array index without bounds checking

Safety

This function does not perform bounds checking

pub fn get(&'a self, i: usize) -> Result<T, Error>[src]

Get array index

pub unsafe fn get_unchecked(&'a self, i: usize) -> T[src]

Get array index without bounds checking

Safety

This function does not perform bounds checking

pub fn into_vec(self) -> Vec<T>[src]

Array as Vec

pub fn as_vec(&'a self) -> Vec<T>[src]

Array as Vec

Trait Implementations

impl<'a, T: Clone + IntoValue + FromValue<'a>> Clone for Array<'a, T>[src]

fn clone(&self) -> Array<'a, T>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a, T: IntoValue + FromValue<'a>> FromValue<'a> for Array<'a, T>[src]

fn from_value(value: Value) -> Self[src]

Convert from OCaml value

impl<'a, T: IntoValue + FromValue<'a>> IntoValue for Array<'a, T>[src]

fn into_value(self, _rt: &Runtime) -> Value[src]

Convert to OCaml value

impl<'a, T: PartialEq + IntoValue + FromValue<'a>> PartialEq<Array<'a, T>> for Array<'a, T>[src]

fn eq(&self, other: &Array<'a, T>) -> bool[src]

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

fn ne(&self, other: &Array<'a, T>) -> bool[src]

This method tests for !=.

impl<'a, T: IntoValue + FromValue<'a>> StructuralPartialEq for Array<'a, T>[src]

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for Array<'a, T> where
    T: RefUnwindSafe

impl<'a, T> !Send for Array<'a, T>

impl<'a, T> !Sync for Array<'a, T>

impl<'a, T> Unpin for Array<'a, T>

impl<'a, T> UnwindSafe for Array<'a, T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.