[][src]Struct jsl::schema::Schema

pub struct Schema { /* fields omitted */ }

An abstract representation of a JSL 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 new_empty() -> Self[src]

Construct a new, non-root, empty-form schema without any extra data.

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

Construct a new, root schema from 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 root_data().is_some().

pub fn root_data(&self) -> &Option<RootData>[src]

Get the root data associated with this schema.

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

pub fn root_data_mut(&mut self) -> &mut Option<RootData>[src]

Same as root_data, but takes a mutable reference.

pub fn root_data_root(self) -> Option<RootData>[src]

Same as root_data, but moves ownership.

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

Get the form of the schema.

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

Same as form, but takes a mutable reference.

pub fn into_form(self) -> Form[src]

Same as form, but moves ownership.

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

Get the extra data on the schema.

Extra data here refers to key-value pairs on a schema which were present on the data, but the keys were not any of the keywords in JSL.

This data is useful if you're implementing custom functionality on top of JSL.

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

Same as extra, but takes a mutable reference.

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

Same as extra, but moves ownership.

Trait Implementations

impl PartialEq<Schema> for Schema[src]

impl Clone for Schema[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Schema[src]

Auto Trait Implementations

impl Send for Schema

impl Sync for Schema

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

The type returned in the event of a conversion error.

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