Skip to main content

Spec

Enum Spec 

Source
pub enum Spec {
    Node(Box<Node>),
    Token(Token),
    Value(Value),
    Obj(Vec<(String, Spec)>),
    Arr(Vec<Spec>),
    Regex(Regex),
    Regexp(String),
}
Expand description

A spec by example.

Variants§

§

Node(Box<Node>)

A compiled node: a builder’s result.

§

Token(Token)

A type token: a required kind.

§

Value(Value)

A literal: optional, its own default.

§

Obj(Vec<(String, Spec)>)

An object spec, keys in order.

§

Arr(Vec<Spec>)

An array spec: empty, one child shape, or a tuple.

§

Regex(Regex)

A regular expression: a required string matching it.

§

Regexp(String)

A regexp as its pattern text, in the shared subset: what the string form reads, and what a JSON Schema pattern imports.

Trait Implementations§

Source§

impl Clone for Spec

Source§

fn clone(&self) -> Spec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Spec

Source§

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

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

impl From<&str> for Spec

Source§

fn from(s: &str) -> Self

Converts to this type from the input type.
Source§

impl From<BigInt> for Spec

Source§

fn from(b: BigInt) -> Self

Converts to this type from the input type.
Source§

impl From<Node> for Spec

Source§

fn from(n: Node) -> Self

Converts to this type from the input type.
Source§

impl From<Regex> for Spec

Source§

fn from(r: Regex) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Spec

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl From<Token> for Spec

Source§

fn from(t: Token) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for Spec

Source§

fn from(v: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<(String, Spec)>> for Spec

Source§

fn from(pairs: Vec<(String, Spec)>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Spec>> for Spec

Source§

fn from(a: Vec<Spec>) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<[(&str, Spec); N]> for Spec

Source§

fn from(pairs: [(&str, Spec); N]) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<[Spec; N]> for Spec

Source§

fn from(a: [Spec; N]) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Spec

Source§

fn from(b: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Spec

Source§

fn from(n: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Spec

Source§

fn from(n: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Spec

Source§

fn from(n: i64) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Spec

§

impl !UnwindSafe for Spec

§

impl Freeze for Spec

§

impl Send for Spec

§

impl Sync for Spec

§

impl Unpin for Spec

§

impl UnsafeUnpin for Spec

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.