pub struct OwnedValue(/* private fields */);
Expand description
Wrapper for an owned value, i.e. Value<'static>
.
Implementations§
source§impl OwnedValue
impl OwnedValue
Methods from Deref<Target = Value<'static>>§
sourcepub fn borrow_clone(&self) -> Value<'_>
pub fn borrow_clone(&self) -> Value<'_>
Clone this value, borrowing the owned data where possible.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Return whether the value is empty. This is the case if:
- The value is Value::Null.
- The value is Value::Bytes or Value::String of length 0.
- The value is Value::Array or Value::Map without items.
sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Return the inner bool if this is a Value::Bool.
sourcepub fn as_int(&self) -> Option<Integer>
pub fn as_int(&self) -> Option<Integer>
Return the inner int if this is a Value::Integer.
sourcepub fn as_float(&self) -> Option<Float>
pub fn as_float(&self) -> Option<Float>
Return the inner float if this is a Value::Float.
sourcepub fn as_bytes(&self) -> Option<&[u8]>
pub fn as_bytes(&self) -> Option<&[u8]>
Return the inner bytes if this is a Value::Bytes.
sourcepub fn as_string(&self) -> Option<&str>
pub fn as_string(&self) -> Option<&str>
Return the inner string if this is a Value::String.
Trait Implementations§
source§impl Clone for OwnedValue
impl Clone for OwnedValue
source§fn clone(&self) -> OwnedValue
fn clone(&self) -> OwnedValue
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for OwnedValue
impl Debug for OwnedValue
source§impl Default for OwnedValue
impl Default for OwnedValue
source§fn default() -> OwnedValue
fn default() -> OwnedValue
Returns the “default value” for a type. Read more
source§impl Deref for OwnedValue
impl Deref for OwnedValue
source§impl DerefMut for OwnedValue
impl DerefMut for OwnedValue
source§impl<'de> Deserialize<'de> for OwnedValue
impl<'de> Deserialize<'de> for OwnedValue
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 Freeze for OwnedValue
impl RefUnwindSafe for OwnedValue
impl Send for OwnedValue
impl Sync for OwnedValue
impl Unpin for OwnedValue
impl UnwindSafe for OwnedValue
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)