Struct RawJsonValue

Source
pub struct RawJsonValue<'text, 'raw> { /* private fields */ }
Expand description

A JSON value in a RawJson.

This struct provides the text and structural information (e.g., kind, parent, children) of a JSON value. Interpreting that text is the responsibility of the user.

To convert this JSON value to a Rust type, you can use the standard TryFrom and TryInto traits. For other parsing approaches, you can use the FromStr trait or other parsing methods to parse the underlying JSON text of this value as shown below:

let text = "1.23";
let json = RawJson::parse(text)?;
let raw: RawJsonValue = json.value();
let parsed: f32 =
    raw.as_number_str()?.parse().map_err(|e| raw.invalid(e))?;
assert_eq!(parsed, 1.23);

For types that implement TryFrom<RawJsonValue<'_, '_>>, you can use the TryInto trait:

let json = RawJson::parse("[1, 2, 3]")?;
let numbers: [u32; 3] = json.value().try_into()?;
assert_eq!(numbers, [1, 2, 3]);

Implementations§

Source§

impl<'text, 'raw> RawJsonValue<'text, 'raw>

Source

pub fn kind(self) -> JsonValueKind

Returns the kind of this JSON value.

Source

pub fn position(self) -> usize

Returns the byte position where this value begins in the JSON text (self.json().text()).

Source

pub fn json(self) -> &'raw RawJson<'text>

Returns a reference to the RawJson instance that contains this value.

Source

pub fn parent(self) -> Option<Self>

Returns the parent value (array or object) that contains this value.

Source

pub fn as_raw_str(self) -> &'text str

Returns the raw JSON text of this value as-is.

Source

pub fn as_boolean_str(self) -> Result<&'text str, JsonParseError>

Similar to RawJsonValue::as_raw_str(), but this method verifies whether the value is a JSON boolean.

§Examples
let json = RawJson::parse("false")?;
assert_eq!(json.value().as_boolean_str()?.parse(), Ok(false));

let json = RawJson::parse("10")?;
assert!(json.value().as_boolean_str().is_err());
Source

pub fn as_integer_str(self) -> Result<&'text str, JsonParseError>

Similar to RawJsonValue::as_raw_str(), but this method verifies whether the value is a JSON integer number.

§Examples
let json = RawJson::parse("123")?;
assert_eq!(json.value().as_integer_str()?.parse(), Ok(123));

let json = RawJson::parse("12.3")?;
assert!(json.value().as_integer_str().is_err());
Source

pub fn as_float_str(self) -> Result<&'text str, JsonParseError>

Similar to RawJsonValue::as_raw_str(), but this method verifies whether the value is a JSON floating-point number.

§Examples
let json = RawJson::parse("12.3")?;
assert_eq!(json.value().as_float_str()?.parse(), Ok(12.3));

let json = RawJson::parse("123")?;
assert!(json.value().as_float_str().is_err());
Source

pub fn as_number_str(self) -> Result<&'text str, JsonParseError>

Similar to RawJsonValue::as_raw_str(), but this method verifies whether the value is a JSON number.

§Examples
let json = RawJson::parse("123")?;
assert_eq!(json.value().as_number_str()?.parse(), Ok(123));

let json = RawJson::parse("12.3")?;
assert_eq!(json.value().as_number_str()?.parse(), Ok(12.3));

let json = RawJson::parse("null")?;
assert!(json.value().as_number_str().is_err());
Source

pub fn to_unquoted_string_str(self) -> Result<Cow<'text, str>, JsonParseError>

Similar to RawJsonValue::as_raw_str(), but this method verifies whether the value is a JSON string and returns the unquoted content of the string.

§Examples
let json = RawJson::parse("\"123\"")?;
assert_eq!(json.value().to_unquoted_string_str()?, "123");
assert_eq!(json.value().to_unquoted_string_str()?.parse(), Ok(123));

let json = RawJson::parse("123")?;
assert!(json.value().to_unquoted_string_str().is_err());
Source

pub fn to_array(self) -> Result<impl Iterator<Item = Self>, JsonParseError>

If the value is a JSON array, this method returns an iterator that iterates over the array’s elements.

§Examples
let json = RawJson::parse("[0, 1, 2]")?;
for (i, v) in json.value().to_array()?.enumerate() {
    assert_eq!(v.as_integer_str()?.parse(), Ok(i));
}

let json = RawJson::parse("null")?;
assert!(json.value().to_array().is_err());
§Note

For converting to a fixed-size array, you can use the TryInto trait instead:

let json = RawJson::parse("[0, 1, 2]")?;
let fixed_array: [usize; 3] = json.value().try_into()?;
Source

pub fn to_object( self, ) -> Result<impl Iterator<Item = (Self, Self)>, JsonParseError>

If the value is a JSON object, this method returns an iterator that iterates over the name and value pairs of the object’s members.

§Examples
let json = RawJson::parse(r#"{"a": 1, "b": 2, "c": 3}"#)?;
let mut members = json.value().to_object()?;
let (k, v) = members.next().expect("some");
assert_eq!(k.to_unquoted_string_str()?, "a");
assert_eq!(v.as_integer_str()?.parse(), Ok(1));

let json = RawJson::parse("null")?;
assert!(json.value().to_object().is_err());
Source

pub fn to_member<'a>( self, name: &'a str, ) -> Result<RawJsonMember<'text, 'raw, 'a>, JsonParseError>

Attempts to access a member of a JSON object by name.

This method returns a RawJsonMember that represents the result of looking up the specified member name. The member may or may not exist, and you can use methods like RawJsonMember::required() or convert it to an Option<T> to handle both cases.

§Examples
let json = RawJson::parse(r#"{"name": "Alice", "age": 30}"#)?;
let obj = json.value();

// Access existing member
let name_value: String = obj.to_member("name")?.required()?.try_into()?;
assert_eq!(name_value, "Alice");

// Handle optional member
let city_member = obj.to_member("city")?;
let city: Option<String> = city_member.try_into()?;
assert_eq!(city, None);
§Performance

This method has O(n) complexity where n is the number of members in the object, as it performs a linear search through all object members to find the requested name. If you need to access multiple members from the same object, consider using RawJsonValue::to_object() instead, which allows you to iterate through all members once and extract the values you need more efficiently.

let json = RawJson::parse(r#"{"name": "Alice", "age": 30, "city": "New York"}"#)?;
let obj = json.value();

// Efficient: single iteration for multiple members
let mut name = None;
let mut age = None;
let mut city = None;
for (key, value) in obj.to_object()? {
    match key.to_unquoted_string_str()?.as_ref() {
        "name" => name = Some(value),
        "age" => age = Some(value),
        "city" => city = Some(value),
        _ => {}
    }
}
Source

pub fn invalid<E>(self, error: E) -> JsonParseError
where E: Into<Box<dyn Send + Sync + Error>>,

Creates a JsonParseError::InvalidValue error for this value.

This is a convenience method that’s equivalent to calling JsonParseError::invalid_value() with this value.

§Examples
let json = RawJson::parse("\"not_a_number\"")?;
let value = json.value();

// These are equivalent:
let error1 = value.invalid("expected a number");
let error2 = nojson::JsonParseError::invalid_value(value, "expected a number");

Trait Implementations§

Source§

impl<'text, 'raw> Clone for RawJsonValue<'text, 'raw>

Source§

fn clone(&self) -> RawJsonValue<'text, 'raw>

Returns a duplicate 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<'text, 'raw> Debug for RawJsonValue<'text, 'raw>

Source§

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

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

impl Display for RawJsonValue<'_, '_>

Source§

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

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

impl DisplayJson for RawJsonValue<'_, '_>

Source§

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

Formats the value as JSON into the provided formatter. Read more
Source§

impl<'text, 'raw> Hash for RawJsonValue<'text, 'raw>

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<'text, 'raw> Ord for RawJsonValue<'text, 'raw>

Source§

fn cmp(&self, other: &RawJsonValue<'text, 'raw>) -> 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<'text, 'raw> PartialEq for RawJsonValue<'text, 'raw>

Source§

fn eq(&self, other: &RawJsonValue<'text, 'raw>) -> 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<'text, 'raw> PartialOrd for RawJsonValue<'text, 'raw>

Source§

fn partial_cmp(&self, other: &RawJsonValue<'text, 'raw>) -> 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<'text, 'raw, T, const N: usize> TryFrom<RawJsonValue<'text, 'raw>> for [T; N]
where T: TryFrom<RawJsonValue<'text, 'raw>>, JsonParseError: From<T::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for ()

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, T0> TryFrom<RawJsonValue<'text, 'raw>> for (T0,)
where T0: TryFrom<RawJsonValue<'text, 'raw>>, JsonParseError: From<T0::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, T0, T1> TryFrom<RawJsonValue<'text, 'raw>> for (T0, T1)
where T0: TryFrom<RawJsonValue<'text, 'raw>>, T1: TryFrom<RawJsonValue<'text, 'raw>>, JsonParseError: From<T0::Error> + From<T1::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, T0, T1, T2> TryFrom<RawJsonValue<'text, 'raw>> for (T0, T1, T2)
where T0: TryFrom<RawJsonValue<'text, 'raw>>, T1: TryFrom<RawJsonValue<'text, 'raw>>, T2: TryFrom<RawJsonValue<'text, 'raw>>, JsonParseError: From<T0::Error> + From<T1::Error> + From<T2::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, T0, T1, T2, T3> TryFrom<RawJsonValue<'text, 'raw>> for (T0, T1, T2, T3)
where T0: TryFrom<RawJsonValue<'text, 'raw>>, T1: TryFrom<RawJsonValue<'text, 'raw>>, T2: TryFrom<RawJsonValue<'text, 'raw>>, T3: TryFrom<RawJsonValue<'text, 'raw>>, JsonParseError: From<T0::Error> + From<T1::Error> + From<T2::Error> + From<T3::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, T0, T1, T2, T3, T4> TryFrom<RawJsonValue<'text, 'raw>> for (T0, T1, T2, T3, T4)
where T0: TryFrom<RawJsonValue<'text, 'raw>>, T1: TryFrom<RawJsonValue<'text, 'raw>>, T2: TryFrom<RawJsonValue<'text, 'raw>>, T3: TryFrom<RawJsonValue<'text, 'raw>>, T4: TryFrom<RawJsonValue<'text, 'raw>>, JsonParseError: From<T0::Error> + From<T1::Error> + From<T2::Error> + From<T3::Error> + From<T4::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, T0, T1, T2, T3, T4, T5> TryFrom<RawJsonValue<'text, 'raw>> for (T0, T1, T2, T3, T4, T5)
where T0: TryFrom<RawJsonValue<'text, 'raw>>, T1: TryFrom<RawJsonValue<'text, 'raw>>, T2: TryFrom<RawJsonValue<'text, 'raw>>, T3: TryFrom<RawJsonValue<'text, 'raw>>, T4: TryFrom<RawJsonValue<'text, 'raw>>, T5: TryFrom<RawJsonValue<'text, 'raw>>, JsonParseError: From<T0::Error> + From<T1::Error> + From<T2::Error> + From<T3::Error> + From<T4::Error> + From<T5::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, T0, T1, T2, T3, T4, T5, T6> TryFrom<RawJsonValue<'text, 'raw>> for (T0, T1, T2, T3, T4, T5, T6)
where T0: TryFrom<RawJsonValue<'text, 'raw>>, T1: TryFrom<RawJsonValue<'text, 'raw>>, T2: TryFrom<RawJsonValue<'text, 'raw>>, T3: TryFrom<RawJsonValue<'text, 'raw>>, T4: TryFrom<RawJsonValue<'text, 'raw>>, T5: TryFrom<RawJsonValue<'text, 'raw>>, T6: TryFrom<RawJsonValue<'text, 'raw>>, JsonParseError: From<T0::Error> + From<T1::Error> + From<T2::Error> + From<T3::Error> + From<T4::Error> + From<T5::Error> + From<T6::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, T0, T1, T2, T3, T4, T5, T6, T7> TryFrom<RawJsonValue<'text, 'raw>> for (T0, T1, T2, T3, T4, T5, T6, T7)
where T0: TryFrom<RawJsonValue<'text, 'raw>>, T1: TryFrom<RawJsonValue<'text, 'raw>>, T2: TryFrom<RawJsonValue<'text, 'raw>>, T3: TryFrom<RawJsonValue<'text, 'raw>>, T4: TryFrom<RawJsonValue<'text, 'raw>>, T5: TryFrom<RawJsonValue<'text, 'raw>>, T6: TryFrom<RawJsonValue<'text, 'raw>>, T7: TryFrom<RawJsonValue<'text, 'raw>>, JsonParseError: From<T0::Error> + From<T1::Error> + From<T2::Error> + From<T3::Error> + From<T4::Error> + From<T5::Error> + From<T6::Error> + From<T7::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, K, V> TryFrom<RawJsonValue<'text, 'raw>> for BTreeMap<K, V>
where K: FromStr + Ord, K::Err: Into<Box<dyn Send + Sync + Error>>, V: TryFrom<RawJsonValue<'text, 'raw>>, JsonParseError: From<V::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, T> TryFrom<RawJsonValue<'text, 'raw>> for BTreeSet<T>
where T: TryFrom<RawJsonValue<'text, 'raw>> + Ord, JsonParseError: From<T::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for Cow<'text, str>

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, K, V> TryFrom<RawJsonValue<'text, 'raw>> for HashMap<K, V>
where K: FromStr + Eq + Hash, K::Err: Into<Box<dyn Send + Sync + Error>>, V: TryFrom<RawJsonValue<'text, 'raw>>, JsonParseError: From<V::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, T> TryFrom<RawJsonValue<'text, 'raw>> for HashSet<T>
where T: TryFrom<RawJsonValue<'text, 'raw>> + Eq + Hash, JsonParseError: From<T::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for IpAddr

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for Ipv4Addr

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for Ipv6Addr

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for NonZeroI128

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for NonZeroI16

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for NonZeroI32

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for NonZeroI64

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for NonZeroI8

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for NonZeroIsize

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for NonZeroU128

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for NonZeroU16

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for NonZeroU32

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for NonZeroU64

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for NonZeroU8

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for NonZeroUsize

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, T> TryFrom<RawJsonValue<'text, 'raw>> for Option<T>
where T: TryFrom<RawJsonValue<'text, 'raw>, Error = JsonParseError>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for PathBuf

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for SocketAddr

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for SocketAddrV4

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for SocketAddrV6

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for String

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, T> TryFrom<RawJsonValue<'text, 'raw>> for Vec<T>
where T: TryFrom<RawJsonValue<'text, 'raw>>, JsonParseError: From<T::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw, T> TryFrom<RawJsonValue<'text, 'raw>> for VecDeque<T>
where T: TryFrom<RawJsonValue<'text, 'raw>>, JsonParseError: From<T::Error>,

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for bool

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for f32

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for f64

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for i128

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for i16

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for i32

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for i64

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for i8

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for isize

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for u128

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for u16

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for u32

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for u64

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for u8

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> TryFrom<RawJsonValue<'text, 'raw>> for usize

Source§

type Error = JsonParseError

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

fn try_from(value: RawJsonValue<'text, 'raw>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'text, 'raw> Copy for RawJsonValue<'text, 'raw>

Source§

impl<'text, 'raw> Eq for RawJsonValue<'text, 'raw>

Source§

impl<'text, 'raw> StructuralPartialEq for RawJsonValue<'text, 'raw>

Auto Trait Implementations§

§

impl<'text, 'raw> Freeze for RawJsonValue<'text, 'raw>

§

impl<'text, 'raw> RefUnwindSafe for RawJsonValue<'text, 'raw>

§

impl<'text, 'raw> Send for RawJsonValue<'text, 'raw>

§

impl<'text, 'raw> Sync for RawJsonValue<'text, 'raw>

§

impl<'text, 'raw> Unpin for RawJsonValue<'text, 'raw>

§

impl<'text, 'raw> UnwindSafe for RawJsonValue<'text, 'raw>

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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> 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.