Skip to main content

InjectEvent

Trait InjectEvent 

Source
pub trait InjectEvent<Input, Path>: Sized {
    // Required method
    fn inject_at(input: Input) -> Self;
}
Expand description

Path-indexed injection into a structural event coproduct.

The path is compile-time routing evidence. It prevents the overlapping implementations that arise when an outer layer owns the same input type as an inner layer and makes that ownership choice explicit in the type system. Unsupported input has no construction capability:

ⓘ
let _ = <behavior::User<behavior::MailAddr, ()> as behavior::InjectEvent<u8, behavior::Here>>::inject_at(7);

Repeated payload types require an explicit ownership path rather than an outermost-first runtime guess:

ⓘ
type Duplicate = behavior::EventLayer<u8, behavior::EventLayer<u8, behavior::User<behavior::MailAddr, ()>>>;
let _ = <Duplicate as behavior::InjectEvent<u8, _>>::inject_at(7);

Required Methods§

Source

fn inject_at(input: Input) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Owned, Inner> InjectEvent<Owned, Here> for EventLayer<Owned, Inner>

Source§

impl<Owned, Inner, Input, Path> InjectEvent<Input, Inside<Path>> for EventLayer<Owned, Inner>
where Inner: InjectEvent<Input, Path>,