pub struct Membership<R: Role> { /* private fields */ }Expand description
The complete declared output set of one plan — the output firewall.
The declared set is the whole set: a sibling that is not in it was not planned, and nothing downstream may materialize one. Structurally non-empty, because a plan that would generate nothing is a disposition rather than a plan.
Every member’s seat is in the kind’s declared roster, because admission refuses one that is not: every walk downstream — encoding, proof, reconstruction, delivery — quantifies over that roster, and a member outside it would be a unit those walks never look at, held by a proof that claims the whole set.
Implementations§
Source§impl<R: Role> Membership<R>
impl<R: Role> Membership<R>
Sourcepub fn encode_into(&self, into: &mut Vec<u8>)
pub fn encode_into(&self, into: &mut Vec<u8>)
Appends this membership’s canonical bytes, in the kind’s declared ROSTER order.
Roster order and never declaration order: a declared output set is order-insensitive, so the same members declared in another order must encode identically. Every member standing under a seat is written rather than only the first, so a membership that doubled a seat encodes differently from one that did not — that is a defect closure reports, and the encoding must not hide it before the check runs.
Source§impl<R: Role> Membership<R>
impl<R: Role> Membership<R>
Sourcepub fn from_member(member: PlannedMember<R>) -> Result<Self, PlanError>
pub fn from_member(member: PlannedMember<R>) -> Result<Self, PlanError>
The one-member output set.
§Errors
Returns one PlanIssue::MembershipForeign where the member’s seat is absent from the kind’s declared roster.
The roster is every downstream walk’s denominator, so a member outside it is refused here rather than admitted, rendered, and dropped from a proof that claims the whole set.
Sourcepub fn declared(
first: PlannedMember<R>,
rest: Vec<PlannedMember<R>>,
) -> Result<Self, PlanError>
pub fn declared( first: PlannedMember<R>, rest: Vec<PlannedMember<R>>, ) -> Result<Self, PlanError>
Declares the complete output set, the first member and the rest.
§Errors
Returns the planning refusal naming BoundAxis::Outputs where the set outgrows MEMBERSHIP_LIMIT, one PlanIssue::MembershipForeign per member whose seat the kind’s roster does not declare, and one PlanIssue::MembershipDoubled per seat two members stand under.
Both checks are here rather than downstream because each is a defect in the DECLARATION of the set: closure matches by seat over the roster, so a membership that reaches it doubled has already made that match elect one member and ignore the other, and one that reaches it with a foreign seat holds a member no walk will ever look at.
Sourcepub fn first(&self) -> &PlannedMember<R>
pub fn first(&self) -> &PlannedMember<R>
The guaranteed first member.
Sourcepub fn members(&self) -> &NonEmpty<PlannedMember<R>, MEMBERSHIP_LIMIT>
pub fn members(&self) -> &NonEmpty<PlannedMember<R>, MEMBERSHIP_LIMIT>
The declared members, the guaranteed first one ahead of the rest.
§Ordering
A declared output set is order-insensitive, and nothing identity-bearing is derived from this order: the canonical encoding walks the kind’s roster instead, so the same members declared in another order reach one plan.
Sourcepub fn under(&self, role: R) -> Option<&PlannedMember<R>>
pub fn under(&self, role: R) -> Option<&PlannedMember<R>>
The member planned under one seat, where one is.
Sourcepub fn members_under(&self, role: R) -> impl Iterator<Item = &PlannedMember<R>>
pub fn members_under(&self, role: R) -> impl Iterator<Item = &PlannedMember<R>>
Every member planned under one seat, in declaration order.
The road a complete-set comparison walks: comparing two memberships by their first member per seat would agree about two sets that differ in their second, which is exactly what a doubled seat produces.
Sourcepub fn count_under(&self, role: R) -> usize
pub fn count_under(&self, role: R) -> usize
How many members are planned under one seat.
Sourcepub fn members_to(
&self,
destination: Destination,
) -> impl Iterator<Item = &PlannedMember<R>>
pub fn members_to( &self, destination: Destination, ) -> impl Iterator<Item = &PlannedMember<R>>
Every member this plan declared into one delivery, in declaration order.
The reading that routes, and it elects nothing: a member’s delivery is its seat’s own constant answer (Role::destination), so a join asking which members it emits and a consumption target asking which cargo it receives take one answer rather than two that agree until one is edited.
Sourcepub fn count_to(&self, destination: Destination) -> usize
pub fn count_to(&self, destination: Destination) -> usize
How many members this plan declared into one delivery.
Zero is a stated answer rather than an absence: a plan that declared nothing into a delivery has an unoccupied one there, which is a different fact from a delivery that carries no bytes.
Sourcepub fn agrees_under(&self, other: &Self, role: R) -> bool
pub fn agrees_under(&self, other: &Self, role: R) -> bool
Whether two memberships name the same members under one seat, as sets.
Trait Implementations§
Source§impl<R: Clone + Role> Clone for Membership<R>
impl<R: Clone + Role> Clone for Membership<R>
Source§fn clone(&self) -> Membership<R>
fn clone(&self) -> Membership<R>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more