pub enum EstablishedCreation<P, Occurrence>{
Installed {
id: CreationId,
kind: CreationKind,
recipient: EstablishedRecipient<P>,
occurrence: PhantomData<fn() -> Occurrence>,
},
Rejected {
id: CreationId,
kind: CreationKind,
reason: CreationRejection,
occurrence: PhantomData<fn() -> Occurrence>,
},
}Expand description
Committed or rejected result for one exact child-protocol occurrence.
Installed is constructed only after fresh allocation, successful
initialization, endpoint establishment, and creator-local binding. It returns the
exact protocol capability. Rejected carries no capability, so a
failed request cannot be used as an established destination. Both variants
preserve Behavior-authored creation provenance.
Occurrence is topology navigation evidence authored by the parent. It
distinguishes duplicate occurrences without becoming another protocol
identity or runtime key. P remains canonical identity. The concrete child
behavior is deliberately absent: consumers that only retain or communicate
with the installed protocol do not have to pretend to be parent actors.
Duplicate occurrences remain incompatible even when their protocols and endpoint representations match:
use behavior::{
Address, CreationKind, CreationSequence, EndpointAddress, EstablishedCreation,
EstablishedRecipient, Protocol,
};
#[derive(Clone, Copy, PartialEq, Eq)]
struct RuntimeAddr(u64);
impl Address for RuntimeAddr { type Nonce = u64; }
struct Endpoint;
impl Clone for Endpoint { fn clone(&self) -> Self { Self } }
impl EndpointAddress for RuntimeAddr {
type Established<P> = Endpoint where P: Protocol<Addr = Self>;
}
struct Worker;
impl Protocol for Worker { type Addr = RuntimeAddr; type Msg = (); }
struct Primary;
struct Backup;
fn accepts_primary(_: EstablishedCreation<Worker, Primary>) {}
let mut sequence = CreationSequence::new();
let id = sequence.issue().expect("fixture creation ID");
let backup: EstablishedCreation<Worker, Backup> = EstablishedCreation::installed(
id,
CreationKind::Birth,
EstablishedRecipient::issued(Endpoint),
);
accepts_primary(backup);Variants§
Installed
Fields
id: CreationIdkind: CreationKindrecipient: EstablishedRecipient<P>occurrence: PhantomData<fn() -> Occurrence>Rejected
Fields
id: CreationIdkind: CreationKindreason: CreationRejectionoccurrence: PhantomData<fn() -> Occurrence>Implementations§
Source§impl<P, Occurrence> EstablishedCreation<P, Occurrence>
impl<P, Occurrence> EstablishedCreation<P, Occurrence>
pub const fn installed( id: CreationId, kind: CreationKind, recipient: EstablishedRecipient<P>, ) -> Self
pub const fn rejected( id: CreationId, kind: CreationKind, reason: CreationRejection, ) -> Self
pub const fn id(&self) -> CreationId
pub const fn kind(&self) -> CreationKind
Sourcepub fn into_recipient(
self,
) -> Result<EstablishedRecipient<P>, CreationRejection>
pub fn into_recipient( self, ) -> Result<EstablishedRecipient<P>, CreationRejection>
Consume the report and return its exact endpoint capability.
§Errors
Returns the original CreationRejection when child creation did not
commit.
Sourcepub fn into_actor<Parent>(
self,
) -> Result<EstablishedActor<RoleChild<Parent, Occurrence>>, CreationRejection>
pub fn into_actor<Parent>( self, ) -> Result<EstablishedActor<RoleChild<Parent, Occurrence>>, CreationRejection>
Recover the concrete installed-actor proof when this occurrence is a
declared role of Parent.
Parent is used only as compile-time topology evidence at this
capability-strengthening boundary; it is not part of the creation-report
identity. Ordinary consumers can retain EstablishedRecipient<P>
without carrying the parent behavior.
§Errors
Returns the original CreationRejection when child creation did not
commit.