Struct OriginSink

Source
pub struct OriginSink<'a> { /* private fields */ }
Expand description

Sink decorator that stamps the provenance of everything a producer emits, and refuses whatever it cannot stamp.

The fight primitives below always build CombatEventOrigin::Core and know nothing about modifiers. A modifier runs its work against OriginSink::proc(real_sink) instead, so everything it emits — directly or through a nested primitive — comes out Proc without any call site threading the marker.

Casts and runs are carried, not refused: push_attack / push_run write the scope’s provenance into the queued cast, which reaches essences::entity::ActionWithDeadline, so the damage it lands ticks later still resolves under this scope’s mark.

The sink fails closed for events it cannot mark: a non-Core scope may only emit events OverlordEvent::set_origin accepts. CastEffectFromEvent has no field of its own to stamp and SpawnEntity would hand a producer a combatant fighting with its own Core actions, so both are refused. A Core scope is unrestricted — Core is what every emit site already builds.

Implementations§

Source§

impl<'a> OriginSink<'a>

Source

pub fn new(inner: &'a mut dyn FightSink, origin: CombatEventOrigin) -> Self

Wraps inner so that every event it receives is stamped with origin.

Source

pub fn proc(inner: &'a mut dyn FightSink) -> Self

The modifier scope: everything emitted through this sink is Proc.

Trait Implementations§

Source§

impl FightSink for OriginSink<'_>

Source§

fn claim_once(&mut self, slot: OnceSlot, armed: i64) -> i64

Forwarded, not re-latched: the budget belongs to the dispatch, and a producer scope running inside one is part of that same dispatch.

Source§

fn push_event(&mut self, event: OverlordEvent) -> Result<(), Error>

Source§

fn push_attack( &mut self, delay: u64, duration: u64, target: Uuid, origin: CombatEventOrigin, ) -> Result<(), Error>

Source§

fn push_run( &mut self, coords: Coordinates, duration: u64, origin: CombatEventOrigin, ) -> Result<(), Error>

Auto Trait Implementations§

§

impl<'a> Freeze for OriginSink<'a>

§

impl<'a> !RefUnwindSafe for OriginSink<'a>

§

impl<'a> !Send for OriginSink<'a>

§

impl<'a> !Sync for OriginSink<'a>

§

impl<'a> Unpin for OriginSink<'a>

§

impl<'a> !UnwindSafe for OriginSink<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more