pub enum Router {
FanAll,
ScriptRouter,
ScriptWeightedFan,
Declared(Path),
}Expand description
WHO CHOOSES THE LANES — the router a route(…) mounted, shipped or the declaring crate’s.
§The axis is CLOSED on the framework’s side and OPEN past it
A BARE word is one of the routers this framework ships, and that vocabulary is closed for the reason every bare vocabulary in this grammar is: a word is a promise this crate can write the whole binding, which it can only keep for a type it SHIPS. A QUOTED PATH is every other router there is — a type the declaring crate wrote, named the way this grammar names every type it did not mint, with no vocabulary to be admitted to. MINT BARE, REFER QUOTED, read at one more position.
§There is no Owed-shaped axis here, and that is an ANSWER rather than an omission
The aggregate’s fold vocabulary carries one: the framework knows what summing reads and what
counting does not, so the grammar can refuse an entry that names the wrong thing. This
position has no such fact to check. Every shipped router is built from the ROSTER alone — the
lanes the slot already declares — and the one knob any of them has
(ScriptWeightedFan’s emphasis) is the lane emphasis the closed design homed in the tower’s own
OPTIONS rather than at this word — and it lands there: the shipped weighted word mints a
lane_emphasis row on <Tower>SearchOptions, read off the WORD rather than off an axis entry.
So a shipped router owes its entry nothing beyond the wiring
both halves of the entry already name, and an axis answering nothing, for all three would be a
seat with one arm.
§The SHIPPED SPELLINGS are the types’ own, in snake case
fan_all, script_router, script_weighted_fan — one word per shipped type, mechanically its
name. The measure vocabulary’s own note records that this grammar’s other closed VALUE
vocabularies are short nouns (dedup(hash), fold(max)); a router is a NAMED TYPE a reader
looks up rather than a concept with a short noun, so the spelling that cannot drift from the
type it binds is the type’s own. SHIPPED and shipped are
the whole of the roster, and the near-miss list, the printed roster and the refusal all read off
them.
Variants§
FanAll
fan_all — every lane asked, flat.
ScriptRouter
script_router — the text cut by writing system, and only the lanes it reached asked.
ScriptWeightedFan
script_weighted_fan — every lane asked, the ones the question is written in leaned on.
Declared(Path)
A router the declaring crate wrote, as router = "path::to::Router" named it.
Nothing here resolves it, which is the mechanism rather than a limitation: two macro expansions cannot see each other, so the path is EMITTED and rustc resolves it at the span of the string its author wrote.
Implementations§
Source§impl Router
impl Router
Sourcepub const SHIPPED: [&'static str; 3]
pub const SHIPPED: [&'static str; 3]
The routers this framework ships, in the order a refusal lists them.
The near-miss list for a bare word inside route(…) is read off this, so the words a
suggestion offers and the words a sentence names cannot drift apart.
Sourcepub fn shipped(word: &str) -> Option<Self>
pub fn shipped(word: &str) -> Option<Self>
The shipped router a bare word names, or None where the word is none of them.
Sourcepub fn as_written(&self) -> String
pub fn as_written(&self) -> String
The word this router was written as — a shipped one’s own spelling, or the declared path’s.
Sourcepub fn spelled(&self, krate: &Path, question: &TokenStream) -> TokenStream
pub fn spelled(&self, krate: &Path, question: &TokenStream) -> TokenStream
THE TYPE A WORD NAMES, as the emission spells it — a shipped router’s path, or the declaring crate’s own verbatim.
question is what the step is HANDED, and it fills the two shipped routers that carry a
question parameter. ScriptRouter carries none — it is spelled for text
and says so in its own Question = str — so the argument goes unspent there, which is a fact
about those three types rather than a case this function invents.
A DECLARED router is emitted exactly as it was written and resolved by rustc at the span of the
string its author wrote, which is the same mechanism Declared states: two
macro expansions cannot see each other, so nothing here looks a path up.