Skip to main content

EnumerableNode

Trait EnumerableNode 

Source
pub trait EnumerableNode: Sync {
    // Required methods
    fn kind(&self) -> &'static str;
    fn doc(&self) -> &'static str;
    fn elements(&self, partial: Option<&Value>) -> Vec<ElementSpec>;

    // Provided methods
    fn open_surface(&self) -> Option<&'static str> { ... }
    fn validate(&self, value: &Value, mode: Mode) -> Vec<Violation>
       where Self: Sized { ... }
}
Expand description

An enumerable node kind of the workload construction grammar.

Required Methods§

Source

fn kind(&self) -> &'static str

Canonical kind discriminant ("workload", "phase", …).

Source

fn doc(&self) -> &'static str

One-line description of the node kind.

Source

fn elements(&self, partial: Option<&Value>) -> Vec<ElementSpec>

Valid sub-elements. partial is the (possibly incomplete) AST value AT this node when the caller has one; nodes may narrow their element set from it. None yields the unconditioned surface.

Provided Methods§

Source

fn open_surface(&self) -> Option<&'static str>

When this node also accepts keys OUTSIDE the enumerated set, the reason (open vocabularies are declared, never implied). None = closed surface.

Source

fn validate(&self, value: &Value, mode: Mode) -> Vec<Violation>
where Self: Sized,

Validate value as an instance of this node kind: unknown keys on closed surfaces, form conformance per element, and (in Mode::Complete) required elements — recursing through nested node references. This is the runtime type check of the construction grammar.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§