#[non_exhaustive]pub struct ParamSpec {
pub name: &'static str,
pub slot_type: SlotType,
pub required: bool,
pub example: &'static str,
pub constraint: Option<ConstConstraint>,
}Expand description
Describes one parameter in a function’s call signature.
A “slot template” — the type-level version of a Slot without
a concrete value. Parameters are listed in positional order
matching the DSL syntax.
A parameter is built with ParamSpec::new or ParamSpec::wire
and the with_ methods, all const, so a signature can live in a
static. The struct is #[non_exhaustive]: a field added later is
not a breaking change to a host that builds one.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: &'static strParameter name (for error messages and describe output).
slot_type: SlotTypeWire or constant, and if constant, what type.
required: boolWhether this parameter must be provided.
example: &'static strExample value for this parameter, as program text, used for
probing compile level and for documentation. Wire params use
"cycle"; a const param with a declared default uses that
default, which passes validation; a const param without one is
empty, since the signature offers no value to show.
constraint: Option<ConstConstraint>Optional assembly-time validation rule. The factory enforces this before
build_node so node constructors can stay infallible and
branch-free at runtime. None = no constraint declared
(default for wires and unconstrained constants).
Implementations§
Source§impl ParamSpec
impl ParamSpec
Sourcepub const fn new(name: &'static str, slot_type: SlotType) -> Self
pub const fn new(name: &'static str, slot_type: SlotType) -> Self
A required parameter name of the slot type slot_type, with no
constraint. Its example is cycle for a wire, which every
program can pass, and empty for a constant, which has none to
offer until Self::with_example gives one.
Sourcepub const fn optional(self) -> Self
pub const fn optional(self) -> Self
The parameter, but one a call may leave out: a constant with a default, or a variadic tail that may be empty.
Sourcepub const fn with_example(self, example: &'static str) -> Self
pub const fn with_example(self, example: &'static str) -> Self
The parameter with example as its example value, written as
program text.
Sourcepub const fn with_constraint(self, c: ConstConstraint) -> Self
pub const fn with_constraint(self, c: ConstConstraint) -> Self
The parameter with the constraint c, which the factory checks
before it builds the node.
Trait Implementations§
Auto Trait Implementations§
impl Forget for ParamSpec
impl Freeze for ParamSpec
impl RefUnwindSafe for ParamSpec
impl Send for ParamSpec
impl Sync for ParamSpec
impl Unpin for ParamSpec
impl UnsafeUnpin for ParamSpec
impl UnwindSafe for ParamSpec
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<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