Skip to main content

Fold

Enum Fold 

Source
pub enum Fold {
    Sum,
    Max,
    Custom(Path),
}
Expand description

WHICH FOLD an election declared — a shipped CITIZEN by its word, or a type by its PATH.

§Two spellings, and the split is the crossing this whole family is built on

semantics(fold(sum)) names one of the framework’s own, BARE and in parentheses, which is the spelling every framework-owned mechanism word in this grammar takes — dedup(hash) is the same shape one family over. semantics(fold = "app::MyFold") names a type the DECLARING CRATE owns, QUOTED, which is the spelling every reference to somebody else’s declaration takes. So the closed half and the open half are told apart by the shape of the value rather than by a rule a reader has to remember: mint bare, refer quoted.

§The shorthand’s vocabulary is the DEFAULT-ABLE citizens, and that is not an arbitrary two

The emission builds a declared fold through Default — it holds a word or a path and no value — so a citizen reachable by word is one that can be built from nothing. Sum and Max are; a Weighted is not, its weights being checked against a query the declaration cannot see. Mean is not a citizen at all: the word is withdrawn, and a fold that divides is one somebody writes where they can see their own absences. Both are refused BY NAME rather than as unknown words, because an author who wrote either had a coherent idea.

Variants§

§

Sum

fold(sum) — Σⱼ bⱼ, the shipped default, named explicitly.

§

Max

fold(max) — maxⱼ bⱼ.

§

Custom(Path)

fold = "app::MyFold" — a type the declaring crate owns, carried VERBATIM and resolved nowhere in this crate: a path naming nothing is E0412 at the string its author wrote, and a type that does not fold this engine’s currency is E0277 where the fold is constructed.

Implementations§

Source§

impl Fold

Source

pub const WORDS: [&'static str; 2]

The two shorthand WORDS, in the order a refusal lists them.

One list rather than a sentence per message, so a third default-able citizen reaches every refusal by arriving here.

Source

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

The citizen a shorthand word names, or None where the word is not one of them.

Trait Implementations§

Source§

impl Clone for Fold

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 Fold

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Send for Fold

§

impl !Sync for Fold

§

impl Freeze for Fold

§

impl RefUnwindSafe for Fold

§

impl Unpin for Fold

§

impl UnsafeUnpin for Fold

§

impl UnwindSafe for Fold

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.