pub struct ConstInit {
pub name: String,
pub slot: String,
pub source: String,
pub fallback: Option<String>,
pub register: bool,
/* private fields */
}Expand description
How one const binding is initialized.
When a kernel is initialized, source (the const’s own expression,
compiled as the output __init_<name>) is evaluated once and its
value written into slot (__const_<name>), which everything that
reads the const reads. A None value falls back to the fallback
input, the value a binder copied from the enclosing scope, so a const
that yields nothing leaves the outer binding visible. Nothing
re-evaluates the const afterwards; Kernel::init does it again.
The assembler writes these records when it resolves a graph, for every const whose value is not known at build, and resolves each name to its index then, so initialization looks nothing up.
Fields§
§name: StringThe const’s name, and the output that reads it.
slot: StringThe input slot holding the captured value.
source: StringThe output computing the const’s expression.
fallback: Option<String>The input holding the enclosing scope’s value, when the const’s expression references names.
register: boolWhether this is the computed starting value of a shared
register rather than a const: slot is the register’s own input,
and initialization writes it only while nothing has written the
register, so a scope attached to a register another scope
declared never seeds it again.
Trait Implementations§
impl Eq for ConstInit
impl StructuralPartialEq for ConstInit
Auto Trait Implementations§
impl Freeze for ConstInit
impl RefUnwindSafe for ConstInit
impl Send for ConstInit
impl Sync for ConstInit
impl Unpin for ConstInit
impl UnsafeUnpin for ConstInit
impl UnwindSafe for ConstInit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more