Skip to main content

ToValue

Trait ToValue 

Source
pub unsafe trait ToValue {
    // Required method
    fn to_value(&self, rt: &Runtime) -> Value;
}
Expand description

ToValue is used to convert from Rust types to OCaml values

NOTE: This should only be used after the OCaml runtime has been initialized, when calling Rust functions from OCaml, the runtime is already initialized otherwise ocaml::Runtime::init should be used

Required Methods§

Source

fn to_value(&self, rt: &Runtime) -> Value

Convert to OCaml value

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ToValue for &[u8]

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for &mut [u8]

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for &mut str

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for &str

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for ()

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for String

Available on non-crate feature no-std only.
Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for bool

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for f32

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for f64

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for i8

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for i16

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for i32

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for i64

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for u8

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for u16

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for u32

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl ToValue for u64

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue, I: ToValue, J: ToValue, K: ToValue, L: ToValue, M: ToValue, N: ToValue, O: ToValue, P: ToValue, Q: ToValue, R: ToValue, S: ToValue, T: ToValue, U: ToValue> ToValue for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue, I: ToValue, J: ToValue, K: ToValue, L: ToValue, M: ToValue, N: ToValue, O: ToValue, P: ToValue, Q: ToValue, R: ToValue, S: ToValue, T: ToValue> ToValue for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue, I: ToValue, J: ToValue, K: ToValue, L: ToValue, M: ToValue, N: ToValue, O: ToValue, P: ToValue, Q: ToValue, R: ToValue, S: ToValue> ToValue for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue, I: ToValue, J: ToValue, K: ToValue, L: ToValue, M: ToValue, N: ToValue, O: ToValue, P: ToValue, Q: ToValue, R: ToValue> ToValue for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue, I: ToValue, J: ToValue, K: ToValue, L: ToValue, M: ToValue, N: ToValue, O: ToValue, P: ToValue, Q: ToValue> ToValue for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue, I: ToValue, J: ToValue, K: ToValue, L: ToValue, M: ToValue, N: ToValue, O: ToValue, P: ToValue> ToValue for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue, I: ToValue, J: ToValue, K: ToValue, L: ToValue, M: ToValue, N: ToValue, O: ToValue> ToValue for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue, I: ToValue, J: ToValue, K: ToValue, L: ToValue, M: ToValue, N: ToValue> ToValue for (A, B, C, D, E, F, G, H, I, J, K, L, M, N)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue, I: ToValue, J: ToValue, K: ToValue, L: ToValue, M: ToValue> ToValue for (A, B, C, D, E, F, G, H, I, J, K, L, M)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue, I: ToValue, J: ToValue, K: ToValue, L: ToValue> ToValue for (A, B, C, D, E, F, G, H, I, J, K, L)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue, I: ToValue, J: ToValue, K: ToValue> ToValue for (A, B, C, D, E, F, G, H, I, J, K)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue, I: ToValue, J: ToValue> ToValue for (A, B, C, D, E, F, G, H, I, J)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue, I: ToValue> ToValue for (A, B, C, D, E, F, G, H, I)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue, H: ToValue> ToValue for (A, B, C, D, E, F, G, H)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue, G: ToValue> ToValue for (A, B, C, D, E, F, G)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue, F: ToValue> ToValue for (A, B, C, D, E, F)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue, E: ToValue> ToValue for (A, B, C, D, E)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue, D: ToValue> ToValue for (A, B, C, D)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue, C: ToValue> ToValue for (A, B, C)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue, B: ToValue> ToValue for (A, B)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<A: ToValue> ToValue for (A,)

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<K: ToValue, V: ToValue> ToValue for BTreeMap<K, V>

Available on non-crate feature no-std only.
Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<T: ToValue, E: ToValue> ToValue for Result<T, E>

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<T: ToValue> ToValue for &T

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<T: ToValue> ToValue for LinkedList<T>

Available on non-crate feature no-std only.
Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<T: ToValue> ToValue for Option<T>

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<T: ToValue> ToValue for Result<T, Error>

Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<V: 'static + ToValue> ToValue for Vec<V>

Available on non-crate feature no-std only.
Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<V: ToValue> ToValue for Box<V>

Available on non-crate feature no-std only.
Source§

fn to_value(&self, rt: &Runtime) -> Value

Source§

impl<const N: usize> ToValue for [u8; N]

Source§

fn to_value(&self, _rt: &Runtime) -> Value

Implementors§