Skip to main content

Router

Enum Router 

Source
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

Source

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.

Source

pub fn shipped(word: &str) -> Option<Self>

The shipped router a bare word names, or None where the word is none of them.

Source

pub fn as_written(&self) -> String

The word this router was written as — a shipped one’s own spelling, or the declared path’s.

Source

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.

Trait Implementations§

Source§

impl Clone for Router

Source§

fn clone(&self) -> Self

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 Router

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.