Skip to main content

Construction

Struct Construction 

Source
pub struct Construction {
    pub at: Option<Path>,
    pub entry: Ident,
    pub finish: Option<Ident>,
    pub fallible: bool,
    pub blanket: Vec<Blanket>,
    pub calls: Vec<Injection>,
}
Expand description

What a declaration says about the way its wrapped type is BUILT.

Every field defaults to the shape the emission had before the vocabulary existed, which is what makes the words free: a declaration that writes no builder(…) carries this value, and the writer turns it into the same tokens the hand-written version emitted.

Fields§

§at: Option<Path>

The builder(…) word’s own path, or None where the declaration wrote none.

Kept for the SPAN, exactly as RecordModel::asynchronous keeps one: the refusal a construction word earns on a declaration that wraps nothing has to blame the word, and a defaulted value has no token for a caret to land on. It is also the one reliable answer to was anything written — every other field has a meaningful default.

§entry: Ident

The FIRST call — Remote::<entry>(…).

new unless entry = "…" named another, which is the house rule stated as a default rather than assumed: a type that keeps the options family has a new, and one that spells its constructor from_ratio says so in one word instead of taking the whole-body escape.

§finish: Option<Ident>

The LAST call — .<finish>(…) — or None where the entry hands back the value itself.

Its presence is what makes this a BUILDER protocol rather than a constructor. Without it the entry’s return value IS the remote and every link is a consuming with_… on the remote itself; with it the entry opens a builder, the links refine the builder, and this call closes it. One word decides between the two, because one word is the whole difference.

§fallible: bool

fallible — the TERMINAL step hands back a Result, and the raise carries its Err.

§The terminal step, which is the finish where there is one and the entry otherwise

The word is read at the step that YIELDS THE VALUE, and the reading is forced by what is useful rather than chosen for symmetry: the shape that exists in the wild is an infallible opening (Remote::builder()) closed by a validating build(), and a word that demanded both halves be fallible could not describe it at all. A protocol whose ENTRY is the fallible half writes no finish, and the same word reaches it.

What the Err joins is the road the raise already has: <db>(try_into(error = "…")) types the row’s TryFrom where a declaration named a type, and the boxed dyn Error + Send + Sync is what it is otherwise — so the ? written here converts through the same From every fallible column conversion already converts through.

§blanket: Vec<Blanket>

on(Type, into) — the BLANKET, one entry per rule, in the order they were written.

A rule keyed by the field’s declared TYPE rather than by its name, which is bon’s own shape and deliberately so: a remote whose builder was generated with #[builder(on(String, into))] has one fact to restate, and restating it per field is how a manifest and its upstream drift.

§calls: Vec<Injection>

call(with = "…", value = "…") — the links NO column feeds, in the order they were written.

The seat for a constructor argument that is not a column of this record: a unit the upstream demands and the row does not store, a mode word, a capacity hint. Repeatable, because a protocol may want several and each is one independent fact.

Implementations§

Source§

impl Construction

Source

pub fn blankets(&self, ty: &Type) -> bool

Whether this field’s declared TYPE is claimed by a blanket rule.

Compared as TOKENS, which is the only comparison available: a macro holds spellings and syn::Type has no semantic equality — u32 and a type Width = u32 are the same type to the compiler and two different tokens here. The rule is stated in the declaration’s own spelling and matched against the declaration’s own spelling, so the two agree by construction, and a blanket that names an alias the fields do not use simply claims nothing.

Source

pub fn call(&self, host: &Path, supplied: &[Supplied]) -> TokenStream

THE CALL — the whole expression that yields the built value.

host is the type the entry is called on. supplied is one entry per value, IN THE ORDER THE DECLARATION WROTE THEM, which is the one order an author can see and therefore the one order a positional argument list may be gathered in.

§Two shapes, and the second is only reached when it has to be

A CHAIN is what a protocol is: Remote::new(a, b).with_c(c).build(). It is also not an attribute position — .with_a(…) #[cfg(…)] .with_b(…) is not Rust — and it has no place to put a &mut setter’s statement. So a protocol carrying a GATED link or a SETTER is unrolled into a block binding, and one carrying neither stays the chain it always was, token for token.

Trait Implementations§

Source§

impl Clone for Construction

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 Construction

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Construction

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Construction

Source§

impl PartialEq for Construction

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Construction

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.