Skip to main content

MapSignal

Struct MapSignal 

Source
pub struct MapSignal<Upstream, S: Signal> { /* private fields */ }
Expand description

Signal graph node which applies a System to each Item of its upstream, forwarding the output of each resulting Signal, see .map_signal.

Trait Implementations§

Source§

impl<Upstream, S: Signal> Clone for MapSignal<Upstream, S>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Upstream, S> SignalVec for MapSignal<Upstream, S>
where Upstream: SignalVec, S: Signal + 'static, S::Item: Clone + Send + Sync + 'static,

Source§

type Item = <S as Signal>::Item

Output type.
Source§

fn register_boxed_signal_vec(self: Box<Self>, world: &mut World) -> SignalHandle

Registers the Systems associated with this SignalVec by consuming its boxed form. Read more
Source§

fn register_signal_vec(self, world: &mut World) -> SignalHandle
where Self: Sized,

Registers the Systems associated with this SignalVec.

Auto Trait Implementations§

§

impl<Upstream, S> Freeze for MapSignal<Upstream, S>

§

impl<Upstream, S> RefUnwindSafe for MapSignal<Upstream, S>

§

impl<Upstream, S> Send for MapSignal<Upstream, S>

§

impl<Upstream, S> Sync for MapSignal<Upstream, S>

§

impl<Upstream, S> Unpin for MapSignal<Upstream, S>

§

impl<Upstream, S> UnwindSafe for MapSignal<Upstream, S>

Blanket Implementations§

Source§

impl<T> Also for T

Source§

fn also<F>(self, block: F) -> Self
where F: FnOnce(&mut Self),

Apply a function to this value and return the (possibly) modified value.
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, Res> Apply<Res> for T
where T: ?Sized,

Source§

fn apply<F>(self, f: F) -> Res
where F: FnOnce(Self) -> Res, Self: Sized,

Apply a function which takes the parameter by value.
Source§

fn apply_ref<F>(&self, f: F) -> Res
where F: FnOnce(&Self) -> Res,

Apply a function which takes the parameter by reference.
Source§

fn apply_mut<F>(&mut self, f: F) -> Res
where F: FnOnce(&mut Self) -> Res,

Apply a function which takes the parameter by mutable reference.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T> Instrument for T

Source§

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

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

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> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<T> IntoSignalVecEither for T
where T: SignalVec,

Source§

fn left_either<R>(self) -> SignalVecEither<Self, R>
where R: SignalVec,

Wrap this SignalVec in the SignalVecEither::Left variant. Read more
Source§

fn right_either<L>(self) -> SignalVecEither<L, Self>
where L: SignalVec,

Wrap this SignalVec in the SignalVecEither::Right variant. Read more
Source§

impl<A> Is for A
where A: Any,

Source§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
Source§

impl<T> SignalVecExt for T
where T: SignalVec + ?Sized,

Source§

fn for_each<O, IOO, F, M>(self, system: F) -> ForEach<Self, O>
where Self: Sized, Self::Item: Send + Sync + 'static, O: Clone + Send + Sync + 'static, IOO: Into<Option<O>> + 'static, F: IntoSystem<In<Vec<VecDiff<Self::Item>>>, IOO, M> + Send + Sync + 'static,

Pass the “raw” Vec<VecDiff<Self::Item>> output of this SignalVec to a System, continuing propagation if the System returns Some or terminating for the frame if it returns None. Unlike most other SignalVec methods, .for_each, returns a Signal, not a SignalVec, since the output type need not be an Option<Vec<VecDiff>>. If the System logic is infallible, wrapping the result in an option is unnecessary.
Source§

fn map<O, F, M>(self, system: F) -> Map<Self, O>
where Self: Sized, Self::Item: Send + Sync + 'static, O: Clone + Send + Sync + 'static, F: IntoSystem<In<Self::Item>, O, M> + Send + Sync + 'static,

Pass each Item of this SignalVec to a System, transforming it. Read more
Source§

fn map_in<O, F>(self, function: F) -> Map<Self, O>
where Self: Sized, Self::Item: Send + Sync + 'static, O: Clone + Send + Sync + 'static, F: FnMut(Self::Item) -> O + Send + Sync + 'static,

Pass each Item of this SignalVec to an FnMut, transforming it. Read more
Source§

fn map_in_ref<O, F>(self, function: F) -> Map<Self, O>
where Self: Sized, Self::Item: Send + Sync + 'static, O: Clone + Send + Sync + 'static, F: FnMut(&Self::Item) -> O + Send + Sync + 'static,

Pass a reference to each Item of this SignalVec to an FnMut, transforming it. Read more
Source§

fn map_signal<S, F, M>(self, system: F) -> MapSignal<Self, S>
where Self: Sized, Self::Item: Send + Sync + 'static, S: Signal + 'static + Clone, S::Item: Clone + Send + Sync, F: IntoSystem<In<Self::Item>, S, M> + Send + Sync + 'static,

Pass each Item of this SignalVec to a System that produces a Signal, forwarding the output of each resulting Signal. Read more
Source§

fn filter<F, M>(self, predicate: F) -> Filter<Self>
where Self: Sized, Self::Item: Clone + Send + Sync + 'static, F: IntoSystem<In<Self::Item>, bool, M> + Send + Sync + 'static,

Pass each Item of this SignalVec to a System, only forwarding those which return true. Read more
Source§

fn filter_map<O, F, M>(self, system: F) -> FilterMap<Self, O>
where Self: Sized, Self::Item: Send + Sync + 'static, O: Clone + Send + Sync + 'static, F: IntoSystem<In<Self::Item>, Option<O>, M> + Send + Sync + 'static,

Pass each Item of this SignalVec to a System, transforming it and only forwarding those which return Some. Read more
Source§

fn filter_signal<F, S, M>(self, system: F) -> FilterSignal<Self>
where Self: Sized, Self::Item: Clone + Send + Sync + 'static, S: Signal<Item = bool> + 'static, F: IntoSystem<In<Self::Item>, S, M> + Send + Sync + 'static,

Pass each Item of this SignalVec to a System that produces a Signal<Item = bool>, only forwarding those whose Signal outputs true. Read more
Source§

fn enumerate(self) -> Enumerate<Self>
where Self: Sized, Self::Item: Clone + Send + Sync + 'static,

Transform each Item into a tuple where the right item is the original item and the left item is a Signal<Item = Option<usize>> which outputs the item’s index or None if it was removed. Note that the Signal<Item = Option<usize>>s are not deduped so consumers must call .dedupe if resending the same index every frame would be spurious. Read more
Source§

fn to_signal(self) -> ToSignal<Self>
where Self: Sized, Self::Item: Clone + Send + Sync + 'static,

Collect this SignalVec’s Items into a Vec, transforming it into an Signal<Item = Vec<Item>>. Read more
Source§

fn is_empty(self) -> IsEmpty<Self>
where Self: Sized, Self::Item: Clone + Send + Sync + 'static,

Transform this SignalVec into a Signal<Item = bool> which outputs whether it’s populated. Read more
Source§

fn len(self) -> Len<Self>
where Self: Sized, Self::Item: Clone + Send + Sync + 'static,

Transform this SignalVec into a Signal<Item = usize> which outputs its length. Read more
Source§

fn sum(self) -> Sum<Self>
where Self: Sized, Self::Item: for<'a> Sum<&'a Self::Item> + Clone + Send + Sync + 'static,

Transform this SignalVec into a Signal<Item = Self::Item> which outputs its sum. Read more
Source§

fn chain<S>(self, other: S) -> Chain<Self, S>
where S: SignalVec<Item = Self::Item>, Self: Sized, Self::Item: Send + Sync + 'static + Clone,

Chains this SignalVec with another SignalVec, producing a SignalVec with all the Items of self, followed by all the Items of other. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where Self: Sized, Self::Item: Clone + Send + Sync + 'static,

Places a Clone of separator between adjacent items of this SignalVec. Read more
Source§

fn intersperse_with<F, M>(self, separator_system: F) -> IntersperseWith<Self>
where Self: Sized, Self::Item: Clone + Send + Sync + 'static, F: IntoSystem<In<BoxedSignal<Option<usize>>>, Self::Item, M> + Send + Sync + 'static,

Place the Item output by the System between adjacent items of this SignalVec; the System takes In a Signal<Item = Option<usize>> which outputs the index of the corresponding Item or None if it has been removed. Note that the Signal<Item = Option<usize>>s are not deduped so consumers must call .dedupe if resending the same index every frame would be spurious. Read more
Source§

fn sort_by<F, M>(self, compare_system: F) -> SortBy<Self>
where Self: Sized, Self::Item: Clone + Send + Sync + 'static, F: IntoSystem<In<(Self::Item, Self::Item)>, Ordering, M> + Send + Sync + 'static,

Sort this SignalVec according to a System which takes In (Self::Item, Self::Item) and returns a core::cmp::Ordering. Read more
Source§

fn sort_by_cmp(self) -> SortBy<Self>
where Self: Sized, Self::Item: Ord + Clone + Send + Sync + 'static,

Sorts this SignalVec according to its Item’s Ord implementation. Read more
Source§

fn sort_by_key<K, F, M>(self, system: F) -> SortByKey<Self>
where Self: Sized, Self::Item: Clone + Send + Sync + 'static, K: Ord + Clone + Send + Sync + 'static, F: IntoSystem<In<Self::Item>, K, M> + Send + Sync + 'static,

Sorts this SignalVec with a key extraction System which takes In an Item and returns a key K that implements Ord which the output will be sorted by. Read more
Source§

fn debug(self) -> Debug<Self>
where Self: Sized, Self::Item: Debug + Clone + Send + Sync + 'static,

Adds debug logging to this SignalVec’s raw VecDiff outputs. Read more
Source§

fn boxed(self) -> Box<dyn SignalVec<Item = Self::Item>>
where Self: Sized,

Erases the type of this SignalVec, allowing it to be used in conjunction with SignalVecs of other concrete types. Read more
Source§

fn boxed_clone( self, ) -> Box<dyn SignalVecDynClone<Item = Self::Item> + Send + Sync>
where Self: Sized + Clone,

Erases the type of this SignalVec, allowing it to be used in conjunction with SignalVecs of other concrete types, particularly in cases where the consumer requires Clone, e.g. .switch_signal_vec. Read more
Source§

fn schedule<Sched: ScheduleLabel + Default + 'static>( self, ) -> ScheduledVec<Sched, Self::Item>
where Self: Sized + 'static,

Assign a schedule to this signal vec chain, see SignalExt::schedule. Read more
Source§

fn register(self, world: &mut World) -> SignalHandle
where Self: Sized,

Activate this SignalVec and all its upstreams, causing them to be evaluated every frame until they are SignalHandle::cleanup-ed, see SignalHandle.
Source§

impl<S> SignalVecTaskExt for S
where S: SignalVec + Send + Sync + 'static,

Source§

fn task(self) -> Box<dyn SignalTask>

Convert this signal vec into a type-erased SignalTask for use with Builder::hold_tasks.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<T> TypeData for T
where T: 'static + Send + Sync + Clone,

Source§

fn clone_type_data(&self) -> Box<dyn TypeData>

Creates a type-erased clone of this value.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> AnyClone for T
where T: Clone + Send + Sync + 'static,

Source§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<T> SignalVecDynClone for T
where T: SignalVec + Clone + 'static,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,