Def

Struct Def 

Source
pub struct Def {
Show 17 fields pub name: Arc<str>, pub typarams: Vec<Arc<str>>, pub params: Vec<(VarId, Arc<str>, Ty)>, pub ret: Ty, pub body: Core, pub tier: Tier, pub effects: Vec<Effect>, pub row: Row, pub declared_effects: Vec<Effect>, pub bounds: Vec<(Arc<str>, Vec<Arc<str>>)>, pub row_is_declared: bool, pub tier_is_annotated: bool, pub tier_is_written: bool, pub is_declaration: bool, pub declares_signal: bool, pub span: Span, pub tier_span: Span,
}

Fields§

§name: Arc<str>§typarams: Vec<Arc<str>>

The names in def map[T, U](…), in the order written.

Carried on the Def rather than left in the scheme because beck iface publishes it: a .becki line that dropped the [T, U] would read back as a signature mentioning two types nobody declared (docs/27 §27.2).

§params: Vec<(VarId, Arc<str>, Ty)>§ret: Ty§body: Core

The whole definition as a lambda, so evaluating the name yields a callable value.

§tier: Tier§effects: Vec<Effect>

The inferred row’s atoms, resolved and sorted — what placement and the infrastructure derivation read.

§row: Row

The inferred row itself, variables and all. This is the signature §3.6 publishes.

§declared_effects: Vec<Effect>

What the signature declared with uses, if anything.

§bounds: Vec<(Arc<str>, Vec<Arc<str>>)>

The trait bounds on this definition’s type parameters, in written order.

Empty for almost everything. A bounded definition is published — beck iface writes def total[T: Priced](xs: list[T]) -> Int, bound and all — and the importer rebuilds the dictionary parameters this module lowered it with from that bound (Checker::import_bounded). It is the bound that crosses rather than the lowered parameters, whose names no source could write.

§row_is_declared: bool

True when the signature stated its row — so an empty one is a bound of “performs nothing” rather than an absent declaration.

A hand-written def with no uses has this false, because writing nothing means “infer it”. A trait method’s row is stated by the trait, empty or not, so every impl method has it true: otherwise def show(self) -> Str would let one implementation reach for a clock and every caller of show would inherit it silently.

§tier_is_annotated: bool

True when this definition’s tier is a given rather than something to solve for (§3.4).

An @on(...) in the source sets it, and so does crate::project’s linker, for every definition that arrived from another module: an imported placement is part of a published signature and the root’s solve must not move it. So it answers “may the solver place this?” and not “did somebody write it down” — tier_is_written is the second question.

§tier_is_written: bool

True when this module’s source wrote the annotation.

Set once, by the checker, and never overwritten, which is the difference that matters: after linking, every definition in the program is annotated in the sense above, and an editor offering to write down the tier it inferred would offer it for definitions that already say (crate::editor::Editor::hints).

§is_declaration: bool

A signature with nothing behind it: a line of a .becki interface, or a trait’s method.

§declares_signal: bool

@signal — a declaration that publishes a signal rather than a function (§3.6).

§span: Span§tier_span: Span

Trait Implementations§

Source§

impl Clone for Def

Source§

fn clone(&self) -> Def

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Def

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Def

§

impl RefUnwindSafe for Def

§

impl Send for Def

§

impl Sync for Def

§

impl Unpin for Def

§

impl UnwindSafe for Def

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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.