Skip to main content

Module scalar

Module scalar 

Source
Expand description

The value kinds a command-line flag can carry, the rules the document states about them, and how a raw argument string becomes the JSON the wire wants.

A Scalar is the only thing this crate knows about a schema: everything richer than these five kinds is a whole-body affair and never reaches a flag. What one carries is what the document said — a pattern, a length, a bound, a step — and every one of those is enforced by Scalar::parse, because a rule that only reaches --help is a rule the user finds out about from the server.

pattern runs on regress, the ECMA-262 engine typify puts inside a generated newtype’s FromStr. One engine, one rule, one set of bytes: a value the command line accepts is a value the generated type accepts by construction, rather than by a hand-written rule kept in step.

Structs§

Bounds
What a numeric schema states beyond being a number.
Text
What a string schema states beyond being a string.

Enums§

Limit
One end of a range.
Scalar
What one flag accepts, as the document describes it.
ScalarError
A raw argument the document’s schema rejects.

Traits§

Numeric
The two number kinds a document can ask one flag for.