pub enum OwnedValue {
Nil,
Boolean(bool),
Number(f64),
String(String),
Table(OwnedTable),
}Expand description
A Rust-owned copy of a script value.
Use this for ordinary data that should outlive the VM or a
reset_decision. Tables are copied
recursively; changes to the original script table do not affect the copy.
This representation supports UTF-8 strings and acyclic tables with boolean,
number, or string keys. Use a live crate::Value for binary strings,
functions, buffers, vectors, userdata, or shared and cyclic table identity.
Variants§
Implementations§
Source§impl OwnedValue
impl OwnedValue
Sourcepub fn deserialize<'de, T>(&'de self) -> Result<T>where
T: Deserialize<'de>,
pub fn deserialize<'de, T>(&'de self) -> Result<T>where
T: Deserialize<'de>,
Reads this value as a Serde-compatible Rust type.
The result may borrow from this owned value. For example, a script
string can be read as &str without making another copy. Conversion
failures include a field path in Error::diagnostic when available.
Sourcepub fn from_serialize<T>(value: &T) -> Result<Self>
pub fn from_serialize<T>(value: &T) -> Result<Self>
Copies Serde-compatible Rust data into a value independent of any VM.
To send data straight to a script global, use
Rustia::insert_serde.
Source§impl OwnedValue
impl OwnedValue
Trait Implementations§
Source§impl Clone for OwnedValue
impl Clone for OwnedValue
Source§fn clone(&self) -> OwnedValue
fn clone(&self) -> OwnedValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more