Skip to main content

SerdeJson

Struct SerdeJson 

Source
pub struct SerdeJson;

Trait Implementations§

Source§

impl Json for SerdeJson

Source§

type Node<'a> = &'a Value

Source§

type PreparedKey = String

A property-name key prepared once at schema compile time for repeated object lookups.
Source§

fn prepare_key(key: &str) -> String

Source§

impl<'a> JsonArrayAccess<'a, SerdeJson> for &'a [Value]

Source§

type Node = &'a Value

Source§

type ElementsIter = Iter<'a, Value>

Source§

fn len(&self) -> usize

Source§

fn elements(&self) -> Iter<'a, Value>

Source§

fn is_unique(&self) -> bool

Whether every element is distinct under JSON equality (uniqueItems).
Source§

impl<'a> JsonNode<'a, SerdeJson> for &'a Value

Source§

type Object = &'a Map<String, Value>

Source§

type Array = &'a [Value]

Source§

fn as_object(&self) -> Option<&'a Map<String, Value>>

Source§

fn as_array(&self) -> Option<&'a [Value]>

Source§

fn as_string(&self) -> Option<Cow<'a, str>>

Source§

fn as_number(&self) -> Option<Cow<'a, Number>>

Borrowed for serde_json, cheaply owned elsewhere; Number keeps the existing numeric machinery applicable to every representation.
Source§

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

Source§

fn is_null(&self) -> bool

Source§

fn json_type(&self) -> JsonType

The JSON type of this node; numbers always report JsonType::Number (integer distinction is a numeric property, not a type tag).
Source§

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

String length in Unicode code points, without extracting the bytes where the representation allows.
Source§

fn equals_value(&self, expected: &Value) -> bool

Deep equality against a schema constant (const/enum); numbers compare mathematically.
Source§

fn to_value(&self) -> Cow<'a, Value>

The node as a serde_json::Value; borrowed for serde_json, materialized elsewhere. Intended for cold paths (error construction, annotations).
Source§

fn cache_key(&self) -> Option<usize>

Identity for the is_valid result cache; None disables caching for this node.
Source§

fn is_number(&self) -> bool

Whether this node is a JSON number, answered without materializing the numeric value. Representations where as_number must construct or format (e.g. Python floats under arbitrary precision) override this to skip that cost. Must agree with as_number().is_some().
Source§

fn is_string(&self) -> bool

Sugar over JsonNode::json_type, the single source of type classification.
Source§

fn container_cache_key(&self) -> Option<usize>

Cache identity restricted to containers, where identities are stable for the whole validation call.
Source§

impl<'a> JsonObjectAccess<'a, SerdeJson> for &'a Map<String, Value>

Source§

type Node = &'a Value

Source§

type MemberName = &'a str

Member name handle; a plain &str where the representation can borrow, owned elsewhere.
Source§

type MembersIter = SerdeMembersIter<'a>

Source§

fn len(&self) -> usize

Source§

fn get(&self, key: &String) -> Option<&'a Value>

Source§

fn members(&self) -> SerdeMembersIter<'a>

Source§

fn is_empty(&self) -> bool

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.