[][src]Struct jddf::schema::Schema

pub struct Schema { /* fields omitted */ }

An abstract representation of a JDDF schema.

This struct is meant for use by validators, code generators, or other high-level processors of schemas. For serialization and deserialization of schemas, instead use Serde.

Methods

impl Schema[src]

pub fn from_parts(
    defs: Option<HashMap<String, Schema>>,
    form: Box<Form>,
    extra: HashMap<String, Value>
) -> Schema
[src]

Construct a new schema from its constituent parts.

defs should be present (i.e. not None) if and only if the constructed schema is a root one. This invariant is not enforced, but many users of this crate will presume that root schemas have definitions they can unwrap. Likewise, some tooling will assume that any schema which has non-None definitions are root schemas.

pub fn from_serde(serde_schema: Serde) -> Result<Self, Error>[src]

Construct a new, root schema from a Serde.

pub fn into_serde(self) -> Serde[src]

Convert this schema into a Serde.

pub fn is_root(&self) -> bool[src]

Is this schema a root schema?

Under the hood, this is entirely equivalent to checking whether definitions().is_some().

pub fn definitions(&self) -> &Option<HashMap<String, Schema>>[src]

Get the definitions associated with this schema.

If this schema is non-root, this returns None.

pub fn form(&self) -> &Form[src]

Get the form of the schema.

pub fn extra(&self) -> &HashMap<String, Value>[src]

Get extra data associated with this schema.

Essentially, this function returns a JSON object of properties that aren't JDDF keywords, but which were included in the schema's JSON. You might use these nonstandard fields to implement custom behavior.

Trait Implementations

impl Clone for Schema[src]

impl Debug for Schema[src]

impl PartialEq<Schema> for Schema[src]

impl StructuralPartialEq for Schema[src]

Auto Trait Implementations

impl RefUnwindSafe for Schema

impl Send for Schema

impl Sync for Schema

impl Unpin for Schema

impl UnwindSafe for Schema

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.