Skip to main content

Module convert

Module convert 

Source
Expand description

Converting between Rust values and Xur values, driven by facet shapes.

RustXur
boolbool
integersintegers (range-checked)
f32, f64floats
String, &str, charstrings
()()
tuplestuples
Vec<T>, arrays, sliceslists
Option<T>, Result<T, E>the prelude’s Option, Result
Vec<u8>, &[u8], [u8; N]bytes
registered typesnative objects
other structs and enumsrecords, named by a type registered for their shape
opaque types up to 8 bytes, like bitflagstheir bits, as an integer

Traits§

ConvertCx
What conversions need to know about the running program.

Functions§

from_value
Converts a Xur value to a Rust value of type T, failing with a runtime error if the value doesn’t fit.
into_value
Converts a Rust value to a Xur value, moving it into a native object if it is of a registered type.
peek_to_value
Converts the value peek looks at, as to_value does.
reflect_error
to_value
Converts a Rust value to a Xur value, cloning it if it is of a registered type.