pub struct WithValue<T, S> { /* private fields */ }Expand description
Receive the component value of an event
This is a convenience wrapper around EventSubscriber that sends the component value along
Note: This only tracks addition and removal of components, not modification. This is due to a limitation with references lifetimes during iteration, as the values can’t be accessed by the subscriber simultaneously.
Implementations§
Trait Implementations§
Source§impl<T: ComponentValue + Clone, S: 'static + Send + Sync + Sink<(Event, T)>> EventSubscriber for WithValue<T, S>
impl<T: ComponentValue + Clone, S: 'static + Send + Sync + Sink<(Event, T)>> EventSubscriber for WithValue<T, S>
Source§fn on_modified(&self, _: &EventData<'_>)
fn on_modified(&self, _: &EventData<'_>)
Handle an incoming event Read more
Source§fn on_removed(&self, storage: &Storage, event: &EventData<'_>)
fn on_removed(&self, storage: &Storage, event: &EventData<'_>)
Handle an incoming event
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Returns true if the subscriber is still connected
Source§fn matches_component(&self, desc: ComponentDesc) -> bool
fn matches_component(&self, desc: ComponentDesc) -> bool
Returns true if the subscriber is interested in this component
Source§fn matches_arch(&self, arch: &Archetype) -> bool
fn matches_arch(&self, arch: &Archetype) -> bool
Returns true if the subscriber is interested in this archetype
Source§fn filter<F>(self, func: F) -> FilterFunc<Self, F>
fn filter<F>(self, func: F) -> FilterFunc<Self, F>
Filter each event before it is generated through a custom function
Source§fn filter_arch<F: StaticFilter>(self, filter: F) -> FilterArch<Self, F>where
Self: Sized,
fn filter_arch<F: StaticFilter>(self, filter: F) -> FilterArch<Self, F>where
Self: Sized,
Filter the archetypes for which the subscriber will receive events
Source§fn filter_components<I: IntoIterator<Item = ComponentKey>>(
self,
components: I,
) -> FilterComponents<Self>where
Self: Sized,
fn filter_components<I: IntoIterator<Item = ComponentKey>>(
self,
components: I,
) -> FilterComponents<Self>where
Self: Sized,
Filter a subscriber to only receive events for a specific set of components
Source§fn filter_event_kind(self, event_kind: EventKind) -> FilterEventKind<Self>where
Self: Sized,
fn filter_event_kind(self, event_kind: EventKind) -> FilterEventKind<Self>where
Self: Sized,
Filter a subscriber to only receive events of a specific kind
Auto Trait Implementations§
impl<T, S> Freeze for WithValue<T, S>where
S: Freeze,
impl<T, S> RefUnwindSafe for WithValue<T, S>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for WithValue<T, S>
impl<T, S> Sync for WithValue<T, S>
impl<T, S> Unpin for WithValue<T, S>
impl<T, S> UnwindSafe for WithValue<T, S>where
S: UnwindSafe,
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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