Enum Value

Source
pub enum Value {
    Null,
    Boolean(bool),
    Number(NumberBuf),
    String(String),
    Array(Array),
    Object(Object),
}
Expand description

JSON Value.

§Parsing

You can parse a Value by importing the Parse trait providing a collection of parsing functions.

§Example

use json_syntax::{Value, Parse, CodeMap};
let (value, code_map) = Value::parse_str("{ \"key\": \"value\" }").unwrap();

The code_map value of type CodeMap contains code-mapping information about all the fragments of the JSON value (their location in the source text).

§Comparison

This type implements the usual comparison traits PartialEq, Eq, PartialOrd and Ord. However by default JSON object entries ordering matters, meaning that { "a": 0, "b": 1 } is not equal to { "b": 1, "a": 0 }. If you want to do comparisons while ignoring entries ordering, you can use the Unordered type (combined with the UnorderedPartialEq trait). Any T reference can be turned into an Unordered<T> reference at will using the BorrowUnordered::as_unordered method.

§Example

use json_syntax::{json, Unordered, BorrowUnordered};

let a = json!({ "a": 0, "b": 1 });
let b = json!({ "b": 1, "a": 0 });

assert_ne!(a, b); // not equals entries are in a different order.
assert_eq!(a.as_unordered(), b.as_unordered()); // equals modulo entry order.
assert_eq!(Unordered(a), Unordered(b)); // equals modulo entry order.

§Printing

The Print trait provide a highly configurable printing method.

§Example

use json_syntax::{Value, Parse, Print};

let value = Value::parse_str("[ 0, 1, { \"key\": \"value\" }, null ]").unwrap().0;

println!("{}", value.pretty_print()); // multi line, indent with 2 spaces
println!("{}", value.inline_print()); // single line, spaces
println!("{}", value.compact_print()); // single line, no spaces

let mut options = json_syntax::print::Options::pretty();
options.indent = json_syntax::print::Indent::Tabs(1);
println!("{}", value.print_with(options)); // multi line, indent with tabs

Variants§

§

Null

null.

§

Boolean(bool)

Boolean true or false.

§

Number(NumberBuf)

Number.

§

String(String)

String.

§

Array(Array)

Array.

§

Object(Object)

Object.

Implementations§

Source§

impl Value

Source

pub fn from_serde_json(value: Value) -> Self

Converts a serde_json::Value into a Value.

§Example
// First we create a `serde_json` value.
let a = serde_json::json!({
  "foo": 1,
  "bar": [2, 3]
});

// We convert the `serde_json` value into a `json_syntax` value.
let b = json_syntax::Value::from_serde_json(a);

// We convert it back into a `serde_json` value.
let _ = json_syntax::Value::into_serde_json(b);
Source

pub fn into_serde_json(self) -> Value

Converts a Value into a serde_json::Value.

§Example
// First we create a `serde_json` value.
let a = serde_json::json!({
  "foo": 1,
  "bar": [2, 3]
});

// We convert the `serde_json` value into a `json_syntax` value.
let b = json_syntax::Value::from_serde_json(a);

// We convert it back into a `serde_json` value.
let _ = json_syntax::Value::into_serde_json(b);
Source§

impl Value

Source

pub fn get_fragment(&self, index: usize) -> Result<FragmentRef<'_>, usize>

Source

pub fn kind(&self) -> Kind

Source

pub fn is_kind(&self, kind: Kind) -> bool

Source

pub fn is_null(&self) -> bool

Source

pub fn is_boolean(&self) -> bool

Source

pub fn is_number(&self) -> bool

Source

pub fn is_string(&self) -> bool

Source

pub fn is_array(&self) -> bool

Source

pub fn is_object(&self) -> bool

Source

pub fn is_empty_array_or_object(&self) -> bool

Checks if the value is either an empty array or an empty object.

Source

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

Source

pub fn as_boolean_mut(&mut self) -> Option<&mut bool>

Source

pub fn as_number(&self) -> Option<&Number>

Source

pub fn as_number_mut(&mut self) -> Option<&mut NumberBuf>

Source

pub fn as_string(&self) -> Option<&str>

Source

pub fn as_str(&self) -> Option<&str>

Alias for as_string.

Source

pub fn as_string_mut(&mut self) -> Option<&mut String>

Source

pub fn as_array(&self) -> Option<&[Self]>

Source

pub fn as_array_mut(&mut self) -> Option<&mut Array>

Source

pub fn force_as_array(&self) -> &[Self]

Return the given value as an array, even if it is not an array.

Returns the input value as is if it is already an array, or puts it in a slice with a single element if it is not.

Source

pub fn as_object(&self) -> Option<&Object>

Source

pub fn as_object_mut(&mut self) -> Option<&mut Object>

Source

pub fn into_boolean(self) -> Option<bool>

Source

pub fn into_number(self) -> Option<NumberBuf>

Source

pub fn into_string(self) -> Option<String>

Source

pub fn into_array(self) -> Option<Array>

Source

pub fn into_object(self) -> Option<Object>

Source

pub fn traverse(&self) -> Traverse<'_>

Source

pub fn count(&self, f: impl FnMut(usize, FragmentRef<'_>) -> bool) -> usize

Recursively count the number of values for which f returns true.

Source

pub fn volume(&self) -> usize

Returns the volume of the value.

The volume is the sum of all values and recursively nested values included in self, including self (the volume is at least 1).

This is equivalent to value.traverse().filter(|(_, f)| f.is_value()).count().

Source

pub fn take(&mut self) -> Self

Move and return the value, leaves null in its place.

Source

pub fn canonicalize_with(&mut self, buffer: &mut Buffer)

Puts this JSON value in canonical form according to RFC 8785.

The given buffer is used to canonicalize the number values.

Source

pub fn canonicalize(&mut self)

Puts this JSON value in canonical form according to RFC 8785.

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

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 Debug for Value

Source§

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

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

impl<'de> Deserialize<'de> for Value

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'de> Deserializer<'de> for Value

Source§

type Error = DeserializeError

The error type that can be returned if some error occurs during deserialization.
Source§

fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Require the Deserializer to figure out how to drive the visitor based on what data type is in the input. Read more
Source§

fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i8 value.
Source§

fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i16 value.
Source§

fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i32 value.
Source§

fn deserialize_i64<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i64 value.
Source§

fn deserialize_i128<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i128 value. Read more
Source§

fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u8 value.
Source§

fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u16 value.
Source§

fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u32 value.
Source§

fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u64 value.
Source§

fn deserialize_u128<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an u128 value. Read more
Source§

fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a f32 value.
Source§

fn deserialize_f64<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a f64 value.
Source§

fn deserialize_option<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an optional value. Read more
Source§

fn deserialize_enum<V>( self, _name: &str, _variants: &'static [&'static str], visitor: V, ) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an enum value with a particular name and possible variants.
Source§

fn deserialize_newtype_struct<V>( self, _name: &'static str, visitor: V, ) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a newtype struct with a particular name.
Source§

fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a bool value.
Source§

fn deserialize_char<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a char value.
Source§

fn deserialize_str<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a string value and does not benefit from taking ownership of buffered data owned by the Deserializer. Read more
Source§

fn deserialize_string<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a string value and would benefit from taking ownership of buffered data owned by the Deserializer. Read more
Source§

fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a byte array and does not benefit from taking ownership of buffered data owned by the Deserializer. Read more
Source§

fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a byte array and would benefit from taking ownership of buffered data owned by the Deserializer. Read more
Source§

fn deserialize_unit<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a unit value.
Source§

fn deserialize_unit_struct<V>( self, _name: &'static str, visitor: V, ) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a unit struct with a particular name.
Source§

fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a sequence of values.
Source§

fn deserialize_tuple<V>( self, _len: usize, visitor: V, ) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a sequence of values and knows how many values there are without looking at the serialized data.
Source§

fn deserialize_tuple_struct<V>( self, _name: &'static str, _len: usize, visitor: V, ) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a tuple struct with a particular name and number of fields.
Source§

fn deserialize_map<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a map of key-value pairs.
Source§

fn deserialize_struct<V>( self, _name: &'static str, _fields: &'static [&'static str], visitor: V, ) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a struct with a particular name and fields.
Source§

fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting the name of a struct field or the discriminant of an enum variant.
Source§

fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor<'de>,

Hint that the Deserialize type needs to deserialize a value whose type doesn’t matter because it is ignored. Read more
Source§

fn is_human_readable(&self) -> bool

Determine whether Deserialize implementations should expect to deserialize their human-readable form. Read more
Source§

impl Display for Value

Source§

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

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

impl<'n> From<&'n Number> for Value

Source§

fn from(n: &'n Number) -> Self

Converts to this type from the input type.
Source§

impl<'s> From<&'s str> for Value

Source§

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

Converts to this type from the input type.
Source§

impl From<NumberBuf<SmallVec<[u8; 16]>>> for Value

Source§

fn from(n: NumberBuf) -> Self

Converts to this type from the input type.
Source§

impl From<Object> for Value

Source§

fn from(o: Object) -> Self

Converts to this type from the input type.
Source§

impl From<SmallString<[u8; 16]>> for Value

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Value

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for String

Source§

fn from(value: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for Value

Source§

fn from(value: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for Value

Source§

fn from(value: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Value>> for Value

Source§

fn from(a: Array) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Value

Source§

fn from(b: bool) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Value

Source§

fn from(n: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Value

Source§

fn from(n: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Value

Source§

fn from(n: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Value

Source§

fn from(n: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Value

Source§

fn from(n: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Value

Source§

fn from(n: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Value

Source§

fn from(n: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Value

Source§

fn from(n: u8) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Value

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Value

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'de> IntoDeserializer<'de, DeserializeError> for Value

Source§

type Deserializer = Value

The type of the deserializer being converted into.
Source§

fn into_deserializer(self) -> Self::Deserializer

Convert this value into a deserializer.
Source§

impl Ord for Value

Source§

fn cmp(&self, other: &Value) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl Parse for Value

Source§

fn parse_in<C, E>( parser: &mut Parser<C, E>, context: Context, ) -> Result<Meta<Self, usize>, Error<E>>
where C: Iterator<Item = Result<DecodedChar, E>>,

Source§

fn parse_slice(content: &[u8]) -> Result<(Self, CodeMap), Error>

Source§

fn parse_slice_with( content: &[u8], options: Options, ) -> Result<(Self, CodeMap), Error>

Source§

fn parse_str(content: &str) -> Result<(Self, CodeMap), Error>

Source§

fn parse_str_with( content: &str, options: Options, ) -> Result<(Self, CodeMap), Error>

Source§

fn parse_infallible_utf8<C>(chars: C) -> Result<(Self, CodeMap), Error>
where C: Iterator<Item = char>,

Source§

fn parse_utf8_infallible_with<C>( chars: C, options: Options, ) -> Result<(Self, CodeMap), Error>
where C: Iterator<Item = char>,

Source§

fn parse_utf8<C, E>(chars: C) -> Result<(Self, CodeMap), Error<E>>
where C: Iterator<Item = Result<char, E>>,

Source§

fn parse_utf8_with<C, E>( chars: C, options: Options, ) -> Result<(Self, CodeMap), Error<E>>
where C: Iterator<Item = Result<char, E>>,

Source§

fn parse_infallible<C>(chars: C) -> Result<(Self, CodeMap), Error>
where C: Iterator<Item = DecodedChar>,

Source§

fn parse_infallible_with<C>( chars: C, options: Options, ) -> Result<(Self, CodeMap), Error>
where C: Iterator<Item = DecodedChar>,

Source§

fn parse<C, E>(chars: C) -> Result<(Self, CodeMap), Error<E>>
where C: Iterator<Item = Result<DecodedChar, E>>,

Source§

fn parse_with<C, E>( chars: C, options: Options, ) -> Result<(Self, CodeMap), Error<E>>
where C: Iterator<Item = Result<DecodedChar, E>>,

Source§

impl PartialEq for Value

Source§

fn eq(&self, other: &Value) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Value

Source§

fn partial_cmp(&self, other: &Value) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PrecomputeSize for Value

Source§

fn pre_compute_size(&self, options: &Options, sizes: &mut Vec<Size>) -> Size

Source§

impl Print for Value

Source§

fn fmt_with( &self, f: &mut Formatter<'_>, options: &Options, indent: usize, ) -> Result

Source§

fn pretty_print(&self) -> Printed<'_, Self>

Print the value with Options::pretty options.
Source§

fn compact_print(&self) -> Printed<'_, Self>

Print the value with Options::compact options.
Source§

fn inline_print(&self) -> Printed<'_, Self>

Print the value with Options::inline options.
Source§

fn print_with(&self, options: Options) -> Printed<'_, Self>

Print the value with the given options.
Source§

impl PrintWithSize for Value

Source§

fn fmt_with_size( &self, f: &mut Formatter<'_>, options: &Options, indent: usize, sizes: &[Size], index: &mut usize, ) -> Result

Source§

impl Serialize for Value

Source§

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

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

impl TryFrom<f32> for Value

Source§

type Error = TryFromFloatError

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

fn try_from(n: f32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<f64> for Value

Source§

type Error = TryFromFloatError

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

fn try_from(n: f64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl UnorderedPartialEq for Value

Source§

fn unordered_eq(&self, other: &Self) -> bool

Source§

impl Eq for Value

Source§

impl StructuralPartialEq for Value

Source§

impl UnorderedEq for Value

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

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> At for T

Source§

fn at<M>(self, metadata: M) -> Meta<T, M>

Wraps self inside a Meta<Self, M> using the given metadata. 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> BorrowStripped for T

Source§

fn stripped(&self) -> &Stripped<T>

Source§

impl<T> BorrowUnordered for T

Source§

impl<T> CallHasher for T
where T: Hash + ?Sized,

Source§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

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

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, C> FromWithContext<T, C> for T

Source§

fn from_with(value: T, _context: &C) -> T

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, U, C> IntoWithContext<U, C> for T
where U: FromWithContext<T, C>,

Source§

fn into_with(self, context: &C) -> U

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§

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, C> TryFromWithContext<U, C> for T
where U: IntoWithContext<T, C>,

Source§

type Error = Infallible

Source§

fn try_from_with( value: U, context: &C, ) -> Result<T, <T as TryFromWithContext<U, C>>::Error>

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, U, C> TryIntoWithContext<U, C> for T
where U: TryFromWithContext<T, C>,

Source§

type Error = <U as TryFromWithContext<T, C>>::Error

Source§

fn try_into_with( self, context: &C, ) -> Result<U, <T as TryIntoWithContext<U, C>>::Error>

Source§

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

Source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

Source§

fn into_with<C>(self, context: C) -> Contextual<T, C>

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,