pub enum Value<'a> {
Null,
Bool(bool),
Number(Number),
String(Cow<'a, str>),
Array(Vec<Value<'a>>),
Object(Versioned<'a>),
Handle(Handle),
}Expand description
The wire-level union of every saveable kind.
See the module-level docs for an overview of when each variant is produced. The
borrowing parameter 'a lets Value::String and nested
records reuse memory owned by the caller without copying.
Variants§
Null
Bool(bool)
Number(Number)
String(Cow<'a, str>)
Array(Vec<Value<'a>>)
Object(Versioned<'a>)
Handle(Handle)
Implementations§
Source§impl Value<'_>
impl Value<'_>
Sourcepub fn into_owned(self) -> Value<'static>
pub fn into_owned(self) -> Value<'static>
Convert this value into a fully owned Value<'static>, deep-copying any borrowed
string or byte data.
This is the allocation-based equivalent of round-tripping through the wire format:
it severs every borrow from the originating data so the result can be stored
independently of its source (for example inside an in-memory
crate::MemoryContext).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value<'static>
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Value<'static>
Available on crate feature
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<'a> Freeze for Value<'a>
impl<'a> RefUnwindSafe for Value<'a>
impl<'a> Send for Value<'a>
impl<'a> Sync for Value<'a>
impl<'a> Unpin for Value<'a>
impl<'a> UnsafeUnpin for Value<'a>
impl<'a> UnwindSafe for Value<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more