pub struct Port {
pub name: String,
pub typ: PortType,
pub lifecycle: Lifecycle,
pub wire_cost: WireCost,
pub constraint: Option<ConstConstraint>,
}Expand description
Descriptor for a single input or output port on a node.
Fields§
§name: StringThe port’s name, as bindings and diagnostics refer to it.
typ: PortTypeThe port’s declared type.
lifecycle: LifecycleWhen the port’s value changes: per cycle, at init, or as configuration.
wire_cost: WireCostCost class for input ports. Ignored for output ports.
constraint: Option<ConstConstraint>Optional value contract this wire must satisfy at runtime
(SRD 15 §“Strict Wire Mode”). The compiler uses this to
decide whether to auto-insert a value assertion when the
upstream source can’t statically be proven to deliver a
satisfying value. None = no constraint declared.
Constraints reuse the same vocabulary as
crate::dsl::const_constraints::ConstConstraint — the
difference is just where the value comes from (a literal
for ConstU64, a wire for Slot::Wire).
Implementations§
Source§impl Port
impl Port
Sourcepub fn new(name: impl Into<String>, typ: PortType) -> Self
pub fn new(name: impl Into<String>, typ: PortType) -> Self
A cycle-lifecycle port of the given type with no constraint.
Sourcepub fn with_lifecycle(
name: impl Into<String>,
typ: PortType,
lifecycle: Lifecycle,
) -> Self
pub fn with_lifecycle( name: impl Into<String>, typ: PortType, lifecycle: Lifecycle, ) -> Self
Create a port with explicit lifecycle.
Sourcepub fn init(name: impl Into<String>, typ: PortType) -> Self
pub fn init(name: impl Into<String>, typ: PortType) -> Self
Create an init-time port (frozen at assembly).
Sourcepub fn with_constraint(self, c: ConstConstraint) -> Self
pub fn with_constraint(self, c: ConstConstraint) -> Self
Attach a value constraint. Used by node authors that want to declare “this wire must satisfy X” so strict-wire-mode can auto-insert the right value assertion. See SRD 15 §“Strict Wire Mode”.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Port
impl RefUnwindSafe for Port
impl Send for Port
impl Sync for Port
impl Unpin for Port
impl UnsafeUnpin for Port
impl UnwindSafe for Port
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