value_bag

Struct ValueBag

source
pub struct ValueBag<'v> { /* private fields */ }
Expand description

A dynamic structured value.

§Capturing values

There are a few ways to capture a value:

  • Using the ValueBag::capture_* and ValueBag::from_* methods.
  • Using the standard From trait.
  • Using the Fill API.

§Using the ValueBag::capture_* methods

ValueBag offers a few constructor methods that capture values of different kinds. These methods require a T: 'static to support downcasting.

use value_bag::ValueBag;

let value = ValueBag::capture_debug(&42i32);

assert_eq!(Some(42), value.to_i64());

Capturing a value using these methods will retain type information so that the contents of the bag can be serialized using an appropriate type.

For cases where the 'static bound can’t be satisfied, there’s also a few constructors that exclude it.

use value_bag::ValueBag;

let value = ValueBag::from_debug(&42i32);

assert_eq!(None, value.to_i64());

These ValueBag::from_* methods are lossy though and ValueBag::capture_* should be preferred.

§Using the standard From trait

Primitive types can be converted into a ValueBag using the standard From trait.

use value_bag::ValueBag;

let value = ValueBag::from(42i32);

assert_eq!(Some(42), value.to_i64());

§Using the Fill API

The fill module provides a way to bridge APIs that may not be directly compatible with other constructor methods.

The Fill trait is automatically implemented for closures, so can usually be used in libraries that can’t implement the trait themselves.

use value_bag::{ValueBag, fill::Slot};

let value = ValueBag::from_fill(&|slot: Slot| {
    #[derive(Debug)]
    struct MyShortLivedValue;

    slot.fill_debug(&MyShortLivedValue)
});

assert_eq!("MyShortLivedValue", format!("{:?}", value));

The trait can also be implemented manually:

use value_bag::{ValueBag, Error, fill::{Slot, Fill}};

struct FillDebug;

impl Fill for FillDebug {
    fn fill(&self, slot: Slot) -> Result<(), Error> {
        slot.fill_debug(&42i32 as &dyn Debug)
    }
}

let value = ValueBag::from_fill(&FillDebug);

assert_eq!(None, value.to_i64());

§Inspecting values

Once you have a ValueBag there are also a few ways to inspect it:

  • Using std::fmt
  • Using sval
  • Using serde
  • Using the ValueBag::visit method.
  • Using the ValueBag::to_* methods.
  • Using the ValueBag::downcast_ref method.

§Using the ValueBag::visit method

The visit module provides a simple visitor API that can be used to inspect the structure of primitives stored in a ValueBag. More complex datatypes can then be handled using std::fmt, sval, or serde.

#[cfg(not(feature = "std"))] fn main() {}
#[cfg(feature = "std")]
use value_bag::{ValueBag, Error, visit::Visit};

// Implement some simple custom serialization
struct MyVisit(Vec<u8>);
impl<'v> Visit<'v> for MyVisit {
    fn visit_any(&mut self, v: ValueBag) -> Result<(), Error> {
        // Fallback to `Debug` if we didn't visit the value specially
        write!(&mut self.0, "{:?}", v).map_err(|_| Error::msg("failed to write value"))
    }

    fn visit_u64(&mut self, v: u64) -> Result<(), Error> {
        self.0.extend_from_slice(itoa_fmt(v).as_slice());
        Ok(())
    }

    fn visit_i64(&mut self, v: i64) -> Result<(), Error> {
        self.0.extend_from_slice(itoa_fmt(v).as_slice());
        Ok(())
    }

    fn visit_f64(&mut self, v: f64) -> Result<(), Error> {
        self.0.extend_from_slice(ryu_fmt(v).as_slice());
        Ok(())
    }

    fn visit_str(&mut self, v: &str) -> Result<(), Error> {
        self.0.push(b'\"');
        self.0.extend_from_slice(escape(v.as_bytes()));
        self.0.push(b'\"');
        Ok(())
    }

    fn visit_bool(&mut self, v: bool) -> Result<(), Error> {
        self.0.extend_from_slice(if v { b"true" } else { b"false" });
        Ok(())
    }
}

let value = ValueBag::from(42i64);

let mut visitor = MyVisit(vec![]);
value.visit(&mut visitor)?;

§Using std::fmt

Any ValueBag can be formatted using the std::fmt machinery as either Debug or Display.

use value_bag::ValueBag;

let value = ValueBag::from(true);

assert_eq!("true", format!("{:?}", value));

§Using sval

When the sval2 feature is enabled, any ValueBag can be serialized using sval. This makes it possible to visit any typed structure captured in the ValueBag, including complex datatypes like maps and sequences.

sval doesn’t need to allocate so can be used in no-std environments.

First, enable the sval2 feature in your Cargo.toml:

[dependencies.value-bag]
features = ["sval2"]

Then stream the contents of the ValueBag using sval.

use value_bag::ValueBag;

let value = ValueBag::from(42i64);
let json = sval_json::stream_to_string(value)?;

§Using serde

When the serde1 feature is enabled, any ValueBag can be serialized using serde. This makes it possible to visit any typed structure captured in the ValueBag, including complex datatypes like maps and sequences.

serde needs a few temporary allocations, so also brings in the std feature.

First, enable the serde1 feature in your Cargo.toml:

[dependencies.value-bag]
features = ["serde1"]

Then stream the contents of the ValueBag using serde.

use value_bag::ValueBag;

let value = ValueBag::from(42i64);
let json = serde_json::to_string(&value)?;

Also see serde.rs for more examples of writing your own serializers.

§Using the ValueBag::to_* methods

ValueBag provides a set of methods for attempting to pull a concrete value out. These are useful for ad-hoc analysis but aren’t intended for exhaustively serializing the contents of a ValueBag.

use value_bag::ValueBag;

let value = ValueBag::capture_display(&42u64);

assert_eq!(Some(42u64), value.to_u64());

§Using the ValueBag::downcast_ref method

When a ValueBag is created using one of the capture_* constructors, it can be downcast back to its original value. This can also be useful for ad-hoc analysis where there’s a common possible non-primitive type that could be captured.

use value_bag::ValueBag;

let timestamp = now();
let value = ValueBag::capture_debug(&timestamp);

assert!(value.downcast_ref::<SystemTime>().is_some());

§Working with sequences

The seq feature of value-bag enables utilities for working with values that are sequences. First, enable the seq feature in your Cargo.toml:

[dependencies.value-bag]
features = ["seq"]

Slices and arrays can be captured as sequences:

use value_bag::ValueBag;

let value = ValueBag::from_seq_slice(&[1, 2, 3]);

assert_eq!("[1,2,3]", serde_json::to_string(&value)?);

A sequence captured with either sval or serde can have its elements extracted:

use value_bag::ValueBag;

let value = ValueBag::from_serde1(&[1.0, 2.0, 3.0]);

let seq = value.to_f64_seq::<Vec<Option<f64>>>().ok_or("not a sequence")?;

assert_eq!(vec![Some(1.0), Some(2.0), Some(3.0)], seq);

Implementations§

source§

impl<'v> ValueBag<'v>

source

pub const fn from_fill<T>(value: &'v T) -> Self
where T: Fill,

Get a value from a fillable slot.

source§

impl<'v> ValueBag<'v>

source

pub fn to_str(&self) -> Option<Cow<'v, str>>

Try get a str from this value.

This method is cheap for primitive types, but may call arbitrary serialization implementations for complex ones. If the serialization implementation produces a short lived string it will be allocated.

source§

impl ValueBag<'static>

source

pub fn try_capture_owned<T>(value: &T) -> Option<Self>
where T: ?Sized + 'static,

Try capture an owned raw value.

This method will return Some if the value is a simple primitive that can be captured without losing its structure. In other cases this method will return None.

source§

impl<'v> ValueBag<'v>

source

pub fn try_capture<T>(value: &'v T) -> Option<Self>
where T: ?Sized + 'static,

Try capture a raw value.

This method will return Some if the value is a simple primitive that can be captured without losing its structure. In other cases this method will return None.

source

pub fn to_u64(&self) -> Option<u64>

Try get a u64 from this value.

This method is cheap for primitive types, but may call arbitrary serialization implementations for complex ones.

source

pub fn to_i64(&self) -> Option<i64>

Try get a i64 from this value.

This method is cheap for primitive types, but may call arbitrary serialization implementations for complex ones.

source

pub fn to_u128(&self) -> Option<u128>

Try get a u128 from this value.

This method is cheap for primitive types, but may call arbitrary serialization implementations for complex ones.

source

pub fn to_i128(&self) -> Option<i128>

Try get a i128 from this value.

This method is cheap for primitive types, but may call arbitrary serialization implementations for complex ones.

source

pub fn to_f64(&self) -> Option<f64>

Try get a f64 from this value.

This method is cheap for primitive types, but may call arbitrary serialization implementations for complex ones.

This method is based on standard TryInto conversions, and will only return Some if there’s a guaranteed lossless conversion between the source and destination types. For a more lenient alternative, see ValueBag::as_f64.

source

pub fn as_f64(&self) -> f64

Get a f64 from this value.

This method is cheap for primitive types, but may call arbitrary serialization implementations for complex ones.

This method is like ValueBag::to_f64 except will always return a f64, regardless of the actual type of underlying value. For numeric types, it will use a regular as conversion, which may be lossy. For non-numeric types it will return NaN.

source

pub fn to_bool(&self) -> Option<bool>

Try get a bool from this value.

This method is cheap for primitive types, but may call arbitrary serialization implementations for complex ones.

source

pub fn to_char(&self) -> Option<char>

Try get a char from this value.

This method is cheap for primitive types, but may call arbitrary serialization implementations for complex ones.

source

pub fn to_borrowed_str(&self) -> Option<&'v str>

Try get a str from this value.

This method is cheap for primitive types. It won’t allocate an owned String if the value is a complex type.

source

pub fn is_empty(&self) -> bool

Check whether this value is empty.

source

pub fn is<T: 'static>(&self) -> bool

Check whether this value can be downcast to T.

source

pub fn downcast_ref<T: 'static>(&self) -> Option<&T>

Try downcast this value to T.

source§

impl<'v> ValueBag<'v>

source

pub fn capture_error<T>(value: &'v T) -> Self
where T: Error + 'static,

Get a value from an error.

source

pub const fn from_dyn_error(value: &'v (dyn Error + 'static)) -> Self

Get a value from an erased value.

source

pub fn to_borrowed_error(&self) -> Option<&'v (dyn Error + 'static)>

Try get an error from this value.

source§

impl<'v> ValueBag<'v>

source

pub fn capture_debug<T>(value: &'v T) -> Self
where T: Debug + 'static,

Get a value from a debuggable type.

This method will attempt to capture the given value as a well-known primitive before resorting to using its Debug implementation.

source

pub fn capture_display<T>(value: &'v T) -> Self
where T: Display + 'static,

Get a value from a displayable type.

This method will attempt to capture the given value as a well-known primitive before resorting to using its Display implementation.

source

pub const fn from_debug<T>(value: &'v T) -> Self
where T: Debug,

Get a value from a debuggable type without capturing support.

source

pub const fn from_display<T>(value: &'v T) -> Self
where T: Display,

Get a value from a displayable type without capturing support.

source

pub const fn from_dyn_debug(value: &'v dyn Debug) -> Self

Get a value from a debuggable type without capturing support.

source

pub const fn from_dyn_display(value: &'v dyn Display) -> Self

Get a value from a displayable type without capturing support.

source§

impl<'v> ValueBag<'v>

source

pub fn to_str_seq<S: Default + Extend<Option<Cow<'v, str>>>>(&self) -> Option<S>

Try get a collection S of strings from this value.

If this value is a sequence then the collection S will be extended with the attempted conversion of each of its elements.

If this value is not a sequence then this method will return None.

source§

impl<'v> ValueBag<'v>

source

pub fn from_seq_slice<I, T>(value: &'v I) -> Self
where I: AsRef<[T]>, &'v T: Into<ValueBag<'v>> + 'v,

Get a value from a sequence of values without capturing support.

source

pub fn to_u64_seq<S: Default + Extend<Option<u64>>>(&self) -> Option<S>

Try get a collection S of u64s from this value.

If this value is a sequence then the collection S will be extended with the attempted conversion of each of its elements.

If this value is not a sequence then this method will return None.

source

pub fn to_i64_seq<S: Default + Extend<Option<i64>>>(&self) -> Option<S>

Try get a collection S of i64s from this value.

If this value is a sequence then the collection S will be extended with the attempted conversion of each of its elements.

If this value is not a sequence then this method will return None.

source

pub fn to_u128_seq<S: Default + Extend<Option<u128>>>(&self) -> Option<S>

Try get a collection S of u128s from this value.

If this value is a sequence then the collection S will be extended with the attempted conversion of each of its elements.

If this value is not a sequence then this method will return None.

source

pub fn to_i128_seq<S: Default + Extend<Option<i128>>>(&self) -> Option<S>

Try get a collection S of i128s from this value.

If this value is a sequence then the collection S will be extended with the attempted conversion of each of its elements.

If this value is not a sequence then this method will return None.

source

pub fn to_f64_seq<S: Default + Extend<Option<f64>>>(&self) -> Option<S>

Try get a collection S of f64s from this value.

If this value is a sequence then the collection S will be extended with the attempted conversion of each of its elements.

If this value is not a sequence then this method will return None.

source

pub fn as_f64_seq<S: Default + Extend<f64>>(&self) -> S

Get a collection S of f64s from this value.

If this value is a sequence then the collection S will be extended with the conversion of each of its elements. The conversion is the same as ValueBag::as_f64.

If this value is not a sequence then this method will return an empty collection.

This is similar to ValueBag::to_f64_seq, but can be more convenient when there’s no need to distinguish between an empty collection and a non-collection, or between f64 and non-f64 elements.

source

pub fn to_bool_seq<S: Default + Extend<Option<bool>>>(&self) -> Option<S>

Try get a collection S of bools from this value.

If this value is a sequence then the collection S will be extended with the attempted conversion of each of its elements.

If this value is not a sequence then this method will return None.

source

pub fn to_char_seq<S: Default + Extend<Option<char>>>(&self) -> Option<S>

Try get a collection S of chars from this value.

If this value is a sequence then the collection S will be extended with the attempted conversion of each of its elements.

If this value is not a sequence then this method will return None.

source

pub fn to_borrowed_str_seq<S: Default + Extend<Option<&'v str>>>( &self, ) -> Option<S>

Try get a collection S of strings from this value.

If this value is a sequence then the collection S will be extended with the attempted conversion of each of its elements.

If this value is not a sequence then this method will return None.

source§

impl<'v> ValueBag<'v>

source

pub fn capture_serde1<T>(value: &'v T) -> Self
where T: Serialize + 'static,

Get a value from a structured type.

This method will attempt to capture the given value as a well-known primitive before resorting to using its Value implementation.

source

pub const fn from_serde1<T>(value: &'v T) -> Self
where T: Serialize,

Get a value from a structured type without capturing support.

source§

impl<'v> ValueBag<'v>

source

pub fn capture_sval2<T>(value: &'v T) -> Self
where T: Value + 'static,

Get a value from a structured type.

This method will attempt to capture the given value as a well-known primitive before resorting to using its Value implementation.

source

pub const fn from_sval2<T>(value: &'v T) -> Self
where T: Value,

Get a value from a structured type without capturing support.

source

pub const fn from_dyn_sval2(value: &'v dyn Value) -> Self

Get a value from a structured type without capturing support.

source§

impl<'v> ValueBag<'v>

source

pub fn visit(&self, visitor: impl Visit<'v>) -> Result<(), Error>

Visit this value using a simple visitor.

The visitor isn’t strictly required to inspect the contents of a value bag. It’s useful for simple cases where a full framework like serde or sval isn’t necessary.

source§

impl<'v> ValueBag<'v>

source

pub fn to_test_token(&self) -> TestToken

Convert the value bag into a token for testing.

This isn’t a general-purpose API for working with values outside of testing.

source§

impl<'v> ValueBag<'v>

source

pub fn to_owned(&self) -> OwnedValueBag

Buffer this value into an OwnedValueBag.

source

pub fn to_shared(&self) -> OwnedValueBag

Buffer this value into an OwnedValueBag, internally storing it in an Arc for cheap cloning.

source§

impl ValueBag<'static>

source

pub fn capture_shared_debug<T>(value: T) -> Self
where T: Debug + Send + Sync + 'static,

Get a value from an owned, sharable, debuggable type.

This method will attempt to capture the given value as a well-known primitive before resorting to using its Debug implementation.

The value will be stored in an Arc for cheap cloning.

source

pub fn capture_shared_display<T>(value: T) -> Self
where T: Display + Send + Sync + 'static,

Get a value from an owned, sharable, displayable type.

This method will attempt to capture the given value as a well-known primitive before resorting to using its Display implementation.

The value will be stored in an Arc for cheap cloning.

source

pub fn capture_shared_error<T>(value: T) -> Self
where T: Error + Send + Sync + 'static,

Get a value from an owned, shared error.

The value will be stored in an Arc for cheap cloning.

source

pub fn capture_shared_sval2<T>(value: T) -> Self
where T: Value + Send + Sync + 'static,

Get a value from an owned, shared, structured type.

This method will attempt to capture the given value as a well-known primitive before resorting to using its Value implementation.

The value will be stored in an Arc for cheap cloning.

source

pub fn capture_shared_serde1<T>(value: T) -> Self
where T: Serialize + Send + Sync + 'static,

Get a value from an owned, shared, structured type.

This method will attempt to capture the given value as a well-known primitive before resorting to using its Value implementation.

The value will be stored in an Arc for cheap cloning.

source

pub fn capture_shared_seq_slice<I, T>(value: I) -> Self
where I: AsRef<[T]> + Send + Sync + 'static, T: Send + Sync + 'static, for<'v> &'v T: Into<ValueBag<'v>>,

Get a value from an owned, shared, sequence.

The value will be stored in an Arc for cheap cloning.

source§

impl<'v> ValueBag<'v>

source

pub const fn empty() -> ValueBag<'v>

Get an empty ValueBag.

source

pub fn from_option(v: Option<impl Into<ValueBag<'v>>>) -> ValueBag<'v>

Get a ValueBag from an Option.

This method will return ValueBag::empty if the value is None.

source

pub const fn from_u8(v: u8) -> ValueBag<'v>

Get a ValueBag from a u8.

source

pub const fn from_u16(v: u16) -> ValueBag<'v>

Get a ValueBag from a u16.

source

pub const fn from_u32(v: u32) -> ValueBag<'v>

Get a ValueBag from a u32.

source

pub const fn from_u64(v: u64) -> ValueBag<'v>

Get a ValueBag from a u64.

source

pub const fn from_usize(v: usize) -> ValueBag<'v>

Get a ValueBag from a usize.

source

pub const fn from_u128_ref(v: &'v u128) -> ValueBag<'v>

Get a ValueBag from a u128.

source

pub const fn from_i8(v: i8) -> ValueBag<'v>

Get a ValueBag from a i8.

source

pub const fn from_i16(v: i16) -> ValueBag<'v>

Get a ValueBag from a i16.

source

pub const fn from_i32(v: i32) -> ValueBag<'v>

Get a ValueBag from a i32.

source

pub const fn from_i64(v: i64) -> ValueBag<'v>

Get a ValueBag from a i64.

source

pub const fn from_isize(v: isize) -> ValueBag<'v>

Get a ValueBag from a isize.

source

pub const fn from_i128_ref(v: &'v i128) -> ValueBag<'v>

Get a ValueBag from a i128.

source

pub const fn from_f32(v: f32) -> ValueBag<'v>

Get a ValueBag from a f32.

source

pub const fn from_f64(v: f64) -> ValueBag<'v>

Get a ValueBag from a f64.

source

pub const fn from_bool(v: bool) -> ValueBag<'v>

Get a ValueBag from a bool.

source

pub const fn from_str(v: &'v str) -> ValueBag<'v>

Get a ValueBag from a str.

source

pub const fn from_char(v: char) -> ValueBag<'v>

Get a ValueBag from a char.

source

pub const fn by_ref(&self) -> ValueBag<'_>

Get a ValueBag from a reference to a ValueBag.

Trait Implementations§

source§

impl<'v> Clone for ValueBag<'v>

source§

fn clone(&self) -> ValueBag<'v>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'v> Debug for ValueBag<'v>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'v> Display for ValueBag<'v>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'v, 'a, 'b> From<&'v &'a [&'b str]> for ValueBag<'v>

source§

fn from(v: &'v &'a [&'b str]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [bool]> for ValueBag<'v>

source§

fn from(v: &'v &'a [bool]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [char]> for ValueBag<'v>

source§

fn from(v: &'v &'a [char]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [f32]> for ValueBag<'v>

source§

fn from(v: &'v &'a [f32]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [f64]> for ValueBag<'v>

source§

fn from(v: &'v &'a [f64]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [i128]> for ValueBag<'v>

source§

fn from(v: &'v &'a [i128]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [i16]> for ValueBag<'v>

source§

fn from(v: &'v &'a [i16]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [i32]> for ValueBag<'v>

source§

fn from(v: &'v &'a [i32]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [i64]> for ValueBag<'v>

source§

fn from(v: &'v &'a [i64]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [i8]> for ValueBag<'v>

source§

fn from(v: &'v &'a [i8]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [isize]> for ValueBag<'v>

source§

fn from(v: &'v &'a [isize]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [u128]> for ValueBag<'v>

source§

fn from(v: &'v &'a [u128]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [u16]> for ValueBag<'v>

source§

fn from(v: &'v &'a [u16]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [u32]> for ValueBag<'v>

source§

fn from(v: &'v &'a [u32]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [u64]> for ValueBag<'v>

source§

fn from(v: &'v &'a [u64]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [u8]> for ValueBag<'v>

source§

fn from(v: &'v &'a [u8]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'v &'a [usize]> for ValueBag<'v>

source§

fn from(v: &'v &'a [usize]) -> Self

Converts to this type from the input type.
source§

impl<'v, 'u> From<&'v &'u dyn Debug> for ValueBag<'v>
where 'u: 'v,

source§

fn from(v: &'v &'u dyn Debug) -> Self

Converts to this type from the input type.
source§

impl<'v, 'u> From<&'v &'u dyn Display> for ValueBag<'v>
where 'u: 'v,

source§

fn from(v: &'v &'u dyn Display) -> Self

Converts to this type from the input type.
source§

impl<'v, 'u> From<&'v &'u (dyn Error + 'static)> for ValueBag<'v>
where 'u: 'v,

source§

fn from(v: &'v &'u (dyn Error + 'static)) -> Self

Converts to this type from the input type.
source§

impl<'v, 'u> From<&'v &'u dyn Value> for ValueBag<'v>
where 'u: 'v,

source§

fn from(v: &'v &'u dyn Value) -> Self

Converts to this type from the input type.
source§

impl<'v, 'u> From<&'v &'u str> for ValueBag<'v>
where 'u: 'v,

source§

fn from(v: &'v &'u str) -> Self

Converts to this type from the input type.
source§

impl<'v, 'a, const N: usize> From<&'v [&'a str; N]> for ValueBag<'v>

source§

fn from(v: &'v [&'a str; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [bool; N]> for ValueBag<'v>

source§

fn from(v: &'v [bool; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [char; N]> for ValueBag<'v>

source§

fn from(v: &'v [char; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [f32; N]> for ValueBag<'v>

source§

fn from(v: &'v [f32; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [f64; N]> for ValueBag<'v>

source§

fn from(v: &'v [f64; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [i128; N]> for ValueBag<'v>

source§

fn from(v: &'v [i128; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [i16; N]> for ValueBag<'v>

source§

fn from(v: &'v [i16; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [i32; N]> for ValueBag<'v>

source§

fn from(v: &'v [i32; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [i64; N]> for ValueBag<'v>

source§

fn from(v: &'v [i64; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [i8; N]> for ValueBag<'v>

source§

fn from(v: &'v [i8; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [isize; N]> for ValueBag<'v>

source§

fn from(v: &'v [isize; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [u128; N]> for ValueBag<'v>

source§

fn from(v: &'v [u128; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [u16; N]> for ValueBag<'v>

source§

fn from(v: &'v [u16; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [u32; N]> for ValueBag<'v>

source§

fn from(v: &'v [u32; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [u64; N]> for ValueBag<'v>

source§

fn from(v: &'v [u64; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [u8; N]> for ValueBag<'v>

source§

fn from(v: &'v [u8; N]) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<&'v [usize; N]> for ValueBag<'v>

source§

fn from(v: &'v [usize; N]) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a ()> for ValueBag<'v>

source§

fn from(_: &'a ()) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Cow<'v, str>> for ValueBag<'v>

source§

fn from(v: &'v Cow<'v, str>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v OwnedValueBag> for ValueBag<'v>

source§

fn from(v: &'v OwnedValueBag) -> ValueBag<'v>

Converts to this type from the input type.
source§

impl<'v> From<&'v String> for ValueBag<'v>

source§

fn from(v: &'v String) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<String>> for ValueBag<'v>

source§

fn from(v: &'v Vec<String>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<bool>> for ValueBag<'v>

source§

fn from(v: &'v Vec<bool>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<char>> for ValueBag<'v>

source§

fn from(v: &'v Vec<char>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<f32>> for ValueBag<'v>

source§

fn from(v: &'v Vec<f32>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<f64>> for ValueBag<'v>

source§

fn from(v: &'v Vec<f64>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<i128>> for ValueBag<'v>

source§

fn from(v: &'v Vec<i128>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<i16>> for ValueBag<'v>

source§

fn from(v: &'v Vec<i16>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<i32>> for ValueBag<'v>

source§

fn from(v: &'v Vec<i32>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<i64>> for ValueBag<'v>

source§

fn from(v: &'v Vec<i64>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<i8>> for ValueBag<'v>

source§

fn from(v: &'v Vec<i8>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<isize>> for ValueBag<'v>

source§

fn from(v: &'v Vec<isize>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<u128>> for ValueBag<'v>

source§

fn from(v: &'v Vec<u128>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<u16>> for ValueBag<'v>

source§

fn from(v: &'v Vec<u16>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<u32>> for ValueBag<'v>

source§

fn from(v: &'v Vec<u32>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<u64>> for ValueBag<'v>

source§

fn from(v: &'v Vec<u64>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<u8>> for ValueBag<'v>

source§

fn from(v: &'v Vec<u8>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v Vec<usize>> for ValueBag<'v>

source§

fn from(v: &'v Vec<usize>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a bool> for ValueBag<'v>

source§

fn from(v: &'a bool) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a char> for ValueBag<'v>

source§

fn from(v: &'a char) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v dyn Debug> for ValueBag<'v>

source§

fn from(v: &'v dyn Debug) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v dyn Display> for ValueBag<'v>

source§

fn from(v: &'v dyn Display) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v (dyn Error + 'static)> for ValueBag<'v>

source§

fn from(v: &'v (dyn Error + 'static)) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v dyn Value> for ValueBag<'v>

source§

fn from(v: &'v dyn Value) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a f32> for ValueBag<'v>

source§

fn from(v: &'a f32) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a f64> for ValueBag<'v>

source§

fn from(v: &'a f64) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v i128> for ValueBag<'v>

source§

fn from(v: &'v i128) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a i16> for ValueBag<'v>

source§

fn from(v: &'a i16) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a i32> for ValueBag<'v>

source§

fn from(v: &'a i32) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a i64> for ValueBag<'v>

source§

fn from(v: &'a i64) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a i8> for ValueBag<'v>

source§

fn from(v: &'a i8) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a isize> for ValueBag<'v>

source§

fn from(v: &'a isize) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v str> for ValueBag<'v>

source§

fn from(v: &'v str) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v u128> for ValueBag<'v>

source§

fn from(v: &'v u128) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a u16> for ValueBag<'v>

source§

fn from(v: &'a u16) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a u32> for ValueBag<'v>

source§

fn from(v: &'a u32) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a u64> for ValueBag<'v>

source§

fn from(v: &'a u64) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a u8> for ValueBag<'v>

source§

fn from(v: &'a u8) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<&'a usize> for ValueBag<'v>

source§

fn from(v: &'a usize) -> Self

Converts to this type from the input type.
source§

impl<'v> From<()> for ValueBag<'v>

source§

fn from(_: ()) -> Self

Converts to this type from the input type.
source§

impl<'v, 'a, 'b> From<Option<&'v &'a [&'b str]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [&'b str]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [bool]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [bool]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [char]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [char]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [f32]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [f32]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [f64]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [f64]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [i128]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [i128]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [i16]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [i16]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [i32]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [i32]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [i64]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [i64]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [i8]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [i8]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [isize]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [isize]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [u128]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [u128]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [u16]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [u16]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [u32]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [u32]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [u64]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [u64]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [u8]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [u8]>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v> From<Option<&'v &'a [usize]>> for ValueBag<'v>

source§

fn from(v: Option<&'v &'a [usize]>) -> Self

Converts to this type from the input type.
source§

impl<'v, 'a, const N: usize> From<Option<&'v [&'a str; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [&'a str; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [bool; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [bool; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [char; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [char; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [f32; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [f32; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [f64; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [f64; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [i128; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [i128; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [i16; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [i16; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [i32; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [i32; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [i64; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [i64; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [i8; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [i8; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [isize; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [isize; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [u128; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [u128; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [u16; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [u16; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [u32; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [u32; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [u64; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [u64; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [u8; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [u8; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v, const N: usize> From<Option<&'v [usize; N]>> for ValueBag<'v>

source§

fn from(v: Option<&'v [usize; N]>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<String>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<String>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<bool>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<bool>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<char>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<char>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<f32>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<f32>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<f64>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<f64>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<i128>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<i128>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<i16>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<i16>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<i32>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<i32>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<i64>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<i64>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<i8>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<i8>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<isize>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<isize>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<u128>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<u128>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<u16>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<u16>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<u32>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<u32>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<u64>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<u64>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<u8>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<u8>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v Vec<usize>>> for ValueBag<'v>

source§

fn from(v: Option<&'v Vec<usize>>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v dyn Debug>> for ValueBag<'v>

source§

fn from(v: Option<&'v dyn Debug>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v dyn Display>> for ValueBag<'v>

source§

fn from(v: Option<&'v dyn Display>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v (dyn Error + 'static)>> for ValueBag<'v>

source§

fn from(v: Option<&'v (dyn Error + 'static)>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v dyn Value>> for ValueBag<'v>

source§

fn from(v: Option<&'v dyn Value>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<&'v str>> for ValueBag<'v>

source§

fn from(v: Option<&'v str>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<bool>> for ValueBag<'v>

source§

fn from(v: Option<bool>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<char>> for ValueBag<'v>

source§

fn from(v: Option<char>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<f32>> for ValueBag<'v>

source§

fn from(v: Option<f32>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<f64>> for ValueBag<'v>

source§

fn from(v: Option<f64>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<i16>> for ValueBag<'v>

source§

fn from(v: Option<i16>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<i32>> for ValueBag<'v>

source§

fn from(v: Option<i32>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<i64>> for ValueBag<'v>

source§

fn from(v: Option<i64>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<i8>> for ValueBag<'v>

source§

fn from(v: Option<i8>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<isize>> for ValueBag<'v>

source§

fn from(v: Option<isize>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<u16>> for ValueBag<'v>

source§

fn from(v: Option<u16>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<u32>> for ValueBag<'v>

source§

fn from(v: Option<u32>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<u64>> for ValueBag<'v>

source§

fn from(v: Option<u64>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<u8>> for ValueBag<'v>

source§

fn from(v: Option<u8>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<Option<usize>> for ValueBag<'v>

source§

fn from(v: Option<usize>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<bool> for ValueBag<'v>

source§

fn from(v: bool) -> Self

Converts to this type from the input type.
source§

impl<'v> From<char> for ValueBag<'v>

source§

fn from(v: char) -> Self

Converts to this type from the input type.
source§

impl<'v> From<f32> for ValueBag<'v>

source§

fn from(v: f32) -> Self

Converts to this type from the input type.
source§

impl<'v> From<f64> for ValueBag<'v>

source§

fn from(v: f64) -> Self

Converts to this type from the input type.
source§

impl<'v> From<i16> for ValueBag<'v>

source§

fn from(v: i16) -> Self

Converts to this type from the input type.
source§

impl<'v> From<i32> for ValueBag<'v>

source§

fn from(v: i32) -> Self

Converts to this type from the input type.
source§

impl<'v> From<i64> for ValueBag<'v>

source§

fn from(v: i64) -> Self

Converts to this type from the input type.
source§

impl<'v> From<i8> for ValueBag<'v>

source§

fn from(v: i8) -> Self

Converts to this type from the input type.
source§

impl<'v> From<isize> for ValueBag<'v>

source§

fn from(v: isize) -> Self

Converts to this type from the input type.
source§

impl<'v> From<u16> for ValueBag<'v>

source§

fn from(v: u16) -> Self

Converts to this type from the input type.
source§

impl<'v> From<u32> for ValueBag<'v>

source§

fn from(v: u32) -> Self

Converts to this type from the input type.
source§

impl<'v> From<u64> for ValueBag<'v>

source§

fn from(v: u64) -> Self

Converts to this type from the input type.
source§

impl<'v> From<u8> for ValueBag<'v>

source§

fn from(v: u8) -> Self

Converts to this type from the input type.
source§

impl<'v> From<usize> for ValueBag<'v>

source§

fn from(v: usize) -> Self

Converts to this type from the input type.
source§

impl<'v> Serialize for ValueBag<'v>

source§

fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<'v> TryFrom<ValueBag<'v>> for &'v (dyn Error + 'static)

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for &'v str

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for Cow<'v, str>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for String

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for bool

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for char

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for f64

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for i128

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for i16

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for i32

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for i64

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for i8

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for isize

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for u128

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for u16

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for u32

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for u64

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for u8

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> TryFrom<ValueBag<'v>> for usize

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: ValueBag<'v>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'v> Value for ValueBag<'v>

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>(&'sval self, s: &mut S) -> Result

Stream this value through a Stream.
source§

fn tag(&self) -> Option<Tag>

Get the tag of this value, if there is one.
source§

fn to_bool(&self) -> Option<bool>

Try convert this value into a boolean.
source§

fn to_f32(&self) -> Option<f32>

Try convert this value into a 32bit binary floating point number.
source§

fn to_f64(&self) -> Option<f64>

Try convert this value into a 64bit binary floating point number.
source§

fn to_i8(&self) -> Option<i8>

Try convert this value into a signed 8bit integer.
source§

fn to_i16(&self) -> Option<i16>

Try convert this value into a signed 16bit integer.
source§

fn to_i32(&self) -> Option<i32>

Try convert this value into a signed 32bit integer.
source§

fn to_i64(&self) -> Option<i64>

Try convert this value into a signed 64bit integer.
source§

fn to_i128(&self) -> Option<i128>

Try convert this value into a signed 128bit integer.
source§

fn to_u8(&self) -> Option<u8>

Try convert this value into an unsigned 8bit integer.
source§

fn to_u16(&self) -> Option<u16>

Try convert this value into an unsigned 16bit integer.
source§

fn to_u32(&self) -> Option<u32>

Try convert this value into an unsigned 32bit integer.
source§

fn to_u64(&self) -> Option<u64>

Try convert this value into an unsigned 64bit integer.
source§

fn to_u128(&self) -> Option<u128>

Try convert this value into an unsigned 128bit integer.
source§

fn to_text(&self) -> Option<&str>

Try convert this value into a text string.
source§

fn to_binary(&self) -> Option<&[u8]>

Try convert this value into a bitstring.
source§

impl<'sval> ValueRef<'sval> for ValueBag<'sval>

source§

fn stream_ref<S: Stream<'sval> + ?Sized>(&self, s: &mut S) -> Result

Stream this value through a Stream.

Auto Trait Implementations§

§

impl<'v> Freeze for ValueBag<'v>

§

impl<'v> !RefUnwindSafe for ValueBag<'v>

§

impl<'v> !Send for ValueBag<'v>

§

impl<'v> !Sync for ValueBag<'v>

§

impl<'v> Unpin for ValueBag<'v>

§

impl<'v> !UnwindSafe for ValueBag<'v>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Value for T
where T: Value,