pub enum Value {
Null,
Int(i64),
Float(f64),
Bool(bool),
String(SharedString),
Bytes(SharedBytes),
Array(SharedArray),
Map(SharedMap),
}Variants§
Null
Int(i64)
Float(f64)
Bool(bool)
String(SharedString)
Bytes(SharedBytes)
Array(SharedArray)
Map(SharedMap)
Implementations§
Source§impl Value
impl Value
pub fn string(value: impl Into<String>) -> Self
pub fn array(values: Vec<Value>) -> Self
pub fn bytes(value: impl Into<Vec<u8>>) -> Self
pub fn map(entries: Vec<(Value, Value)>) -> Self
pub fn into_owned_string(self) -> Result<String, Self>
pub fn into_owned_array(self) -> Result<Vec<Value>, Self>
pub fn into_owned_bytes(self) -> Result<Vec<u8>, Self>
pub fn into_owned_map(self) -> Result<VmMap, Self>
Trait Implementations§
Source§impl FormatArgument for Value
impl FormatArgument for Value
Source§fn supports_format(&self, specifier: &Specifier) -> bool
fn supports_format(&self, specifier: &Specifier) -> bool
Returns
true if self can be formatted using the given specifier.Source§fn fmt_display(&self, f: &mut Formatter<'_>) -> Result
fn fmt_display(&self, f: &mut Formatter<'_>) -> Result
Formats the value the way it would be formatted if it implemented
std::fmt::Display.Source§fn fmt_debug(&self, f: &mut Formatter<'_>) -> Result
fn fmt_debug(&self, f: &mut Formatter<'_>) -> Result
Formats the value the way it would be formatted if it implemented
std::fmt::Debug.Source§fn fmt_octal(&self, f: &mut Formatter<'_>) -> Result
fn fmt_octal(&self, f: &mut Formatter<'_>) -> Result
Formats the value the way it would be formatted if it implemented
std::fmt::Octal.Source§fn fmt_lower_hex(&self, f: &mut Formatter<'_>) -> Result
fn fmt_lower_hex(&self, f: &mut Formatter<'_>) -> Result
Formats the value the way it would be formatted if it implemented
std::fmt::LowerHex.Source§fn fmt_upper_hex(&self, f: &mut Formatter<'_>) -> Result
fn fmt_upper_hex(&self, f: &mut Formatter<'_>) -> Result
Formats the value the way it would be formatted if it implemented
std::fmt::UpperHex.Source§fn fmt_binary(&self, f: &mut Formatter<'_>) -> Result
fn fmt_binary(&self, f: &mut Formatter<'_>) -> Result
Formats the value the way it would be formatted if it implemented
std::fmt::Binary.Source§fn fmt_lower_exp(&self, f: &mut Formatter<'_>) -> Result
fn fmt_lower_exp(&self, f: &mut Formatter<'_>) -> Result
Formats the value the way it would be formatted if it implemented
std::fmt::LowerExp.Source§fn fmt_upper_exp(&self, f: &mut Formatter<'_>) -> Result
fn fmt_upper_exp(&self, f: &mut Formatter<'_>) -> Result
Formats the value the way it would be formatted if it implemented
std::fmt::UpperExp.Source§fn to_usize(&self) -> Result<usize, ()>
fn to_usize(&self) -> Result<usize, ()>
Performs a type conversion into
usize that might fail. Like TryInto<usize>, but does not
consume self. The parser uses this to support formats whose width or precision use “dollar
syntax”. For more information about these, see std::fmt. The default implementation always
returns an error.Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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