Skip to main content

MapSome

Struct MapSome 

Source
pub struct MapSome<Upstream, O> { /* private fields */ }
Expand description

Signal graph node whose system only runs when its upstream outputs Some, see .map_some.

Trait Implementations§

Source§

impl<Upstream, O> Clone for MapSome<Upstream, O>

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, O> Signal for MapSome<Upstream, O>
where Upstream: Signal, O: 'static,

Source§

type Item = Option<O>

Output type.
Source§

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

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

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

Registers the Systems associated with this Signal.

Auto Trait Implementations§

§

impl<Upstream, O> Freeze for MapSome<Upstream, O>

§

impl<Upstream, O> RefUnwindSafe for MapSome<Upstream, O>

§

impl<Upstream, O> Send for MapSome<Upstream, O>

§

impl<Upstream, O> Sync for MapSome<Upstream, O>

§

impl<Upstream, O> Unpin for MapSome<Upstream, O>

§

impl<Upstream, O> UnwindSafe for MapSome<Upstream, O>

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> IntoSignalEither for T
where T: Signal,

Source§

fn left_either<R>(self) -> SignalEither<Self, R>
where R: Signal,

Wrap this Signal in the SignalEither::Left variant. Read more
Source§

fn right_either<L>(self) -> SignalEither<L, Self>
where L: Signal,

Wrap this Signal in the SignalEither::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> SignalExt for T
where T: Signal + ?Sized,

Source§

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

Pass the output of this Signal to a System, continuing propagation if the System returns Some or terminating for the frame if it returns None. If the System logic is infallible, wrapping the result in an Option is unnecessary. Read more
Source§

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

Pass the output of this Signal to an FnMut, continuing propagation if the FnMut returns Some or terminating for the frame if it returns None. If the FnMut logic is infallible, wrapping the result in an Option is unnecessary. Read more
Source§

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

Pass a reference to the output of this Signal to an FnMut, continuing propagation if the FnMut returns Some or terminating for the frame if it returns None. If the FnMut logic is infallible, wrapping the result in an Option is unnecessary. Read more
Source§

fn component<C>(self) -> MapComponent<Self, C>
where Self: Sized + Signal<Item = Entity>, C: Component + Clone,

Map this Signal’s output Entity to its C Component, terminating for the frame if it does not exist. Read more
Source§

fn component_option<C>(self) -> ComponentOption<Self, C>
where Self: Sized + Signal<Item = Entity>, C: Component + Clone,

Map this Signal’s output Entity to its C Component, always outputting an Option. Read more
Source§

fn component_changed<C>(self) -> ComponentChanged<Self, C>
where Self: Sized + Signal<Item = Entity>, C: Component + Clone,

Map this Signal’s output Entity to its C Component on frames it has Changed, terminating for the frame if it does not exist or has not Changed. Read more
Source§

fn has_component<C>(self) -> HasComponent<Self, C>
where Self: Sized + Signal<Item = Entity>, C: Component,

Map this Signal’s output Entity to a bool representing whether it has some Component. Read more
Source§

fn dedupe(self) -> Dedupe<Self>
where Self: Sized, Self::Item: PartialEq + Clone + Send + Sync + 'static,

Terminates this Signal on frames where the output was the same as the last. Read more
Source§

fn take(self, count: usize) -> Take<Self>
where Self: Sized, Self::Item: Clone + Send + Sync + 'static,

Outputs up to the first count values from this Signal, and then terminates for all subsequent frames. Read more
Source§

fn skip(self, count: usize) -> Skip<Self>
where Self: Sized, Self::Item: Clone + Send + Sync + 'static,

Skips the first count values from this Signal, then outputs all subsequent values. Read more
Source§

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

Outputs this Signal’s first value and then terminates for all subsequent frames. Read more
Source§

fn eq(self, value: Self::Item) -> Eq<Self>
where Self: Sized, Self::Item: PartialEq + Send + Sync,

Output this Signal’s equality with a fixed value. Read more
Source§

fn neq(self, value: Self::Item) -> Neq<Self>
where Self: Sized, Self::Item: PartialEq + Send + Sync,

Output this Signal’s inequality with a fixed value. Read more
Source§

fn not(self) -> Not<Self>
where Self: Sized, <Self as Signal>::Item: Not + 'static, <<Self as Signal>::Item as Not>::Output: Clone + Send + Sync,

Applies ops::Not to this Signal’s output. Read more
Source§

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

Terminate this Signal on frames where the predicate System returns false. Read more
Source§

fn zip<Other>(self, other: Other) -> Zip<Self, Other>
where Self: Sized, Other: Signal, Self::Item: Clone + Send + Sync + 'static, Other::Item: Clone + Send + Sync + 'static,

Combines this Signal with another Signal, outputting a tuple with both of their latest outputs. The resulting Signal will only output a value when both input Signals have outputted a value. Read more
Source§

fn flatten(self) -> Flatten<Self>
where Self: Sized, Self::Item: Signal + Clone + 'static, <Self::Item as Signal>::Item: Clone + Send + Sync,

Outputs this Signal’s output Signal’s output. Read more
Source§

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

Maps this Signal’s output to another Signal, switching to its output. Read more
Source§

fn switch_signal_vec<S, F, M>(self, switcher: F) -> SwitchSignalVec<Self, S>
where Self: Sized, S: SignalVec + Clone, S::Item: Clone + Send + Sync + 'static, F: IntoSystem<In<Self::Item>, S, M> + Send + Sync + 'static,

Maps this Signal’s output to a SignalVec, switching to its output. Useful when the reactive list target changes depending on some other state. Read more
Source§

fn switch_signal_map<S, F, M>(self, switcher: F) -> SwitchSignalMap<Self, S>
where Self: Sized, S: SignalMap + Clone, S::Key: Clone + Send + Sync + 'static, S::Value: Clone + Send + Sync + 'static, F: IntoSystem<In<Self::Item>, S, M> + Send + Sync + 'static,

Maps this Signal’s output to a SignalMap, switching to its output. Useful when the reactive map target changes depending on some other state. Read more
Source§

fn throttle(self, duration: Duration) -> Throttle<Self>
where Self: Sized, Self::Item: Clone + Send + Sync + 'static,

Delays subsequent outputs from this Signal for some Duration. Read more
Source§

fn map_bool<O, IOO, TF, FF, TM, FM>( self, true_system: TF, false_system: FF, ) -> MapBool<Self, O>
where Self: Sized + Signal<Item = bool>, O: Clone + Send + Sync + 'static, IOO: Into<Option<O>> + 'static, TF: IntoSystem<In<()>, IOO, TM> + Send + Sync + 'static, FF: IntoSystem<In<()>, IOO, FM> + Send + Sync + 'static,

Maps this Signal to some System depending on its bool output. Read more
Source§

fn map_bool_in<O, IOO, TF, FF>( self, true_fn: TF, false_fn: FF, ) -> MapBool<Self, O>
where Self: Sized + Signal<Item = bool>, O: Clone + Send + Sync + 'static, IOO: Into<Option<O>> + 'static, TF: FnMut() -> IOO + Send + Sync + 'static, FF: FnMut() -> IOO + Send + Sync + 'static,

Maps this Signal to some FnMut depending on its bool output. Read more
Source§

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

If this Signal outputs true, output the System result wrapped in Some, otherwise output None. Read more
Source§

fn map_true_in<O, F>(self, function: F) -> MapTrue<Self, O>
where Self: Sized + Signal<Item = bool>, O: Clone + Send + Sync + 'static, F: FnMut() -> O + Send + Sync + 'static,

If this Signal outputs true, output the FnMut result wrapped in Some, otherwise output None. Read more
Source§

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

If this Signal outputs false, output the System result wrapped in Some, otherwise output None. Read more
Source§

fn map_false_in<O, F>(self, function: F) -> MapFalse<Self, O>
where Self: Sized + Signal<Item = bool>, O: Clone + Send + Sync + 'static, F: FnMut() -> O + Send + Sync + 'static,

If this Signal outputs false, output the FnMut result wrapped in Some, otherwise output None. Read more
Source§

fn map_option<I, O, IOO, SF, NF, SM, NM>( self, some_system: SF, none_system: NF, ) -> MapOption<Self, O>
where Self: Sized + Signal<Item = Option<I>>, I: 'static, O: Clone + Send + Sync + 'static, IOO: Into<Option<O>> + 'static, SF: IntoSystem<In<I>, IOO, SM> + Send + Sync + 'static, NF: IntoSystem<In<()>, IOO, NM> + Send + Sync + 'static,

Maps this Signal to some System depending on its Option output. Read more
Source§

fn map_option_in<I, O, IOO, SF, NF>( self, some_fn: SF, none_fn: NF, ) -> MapOption<Self, O>
where Self: Sized + Signal<Item = Option<I>>, I: 'static, O: Clone + Send + Sync + 'static, IOO: Into<Option<O>> + 'static, SF: FnMut(I) -> IOO + Send + Sync + 'static, NF: FnMut() -> IOO + Send + Sync + 'static,

Maps this Signal to some FnMut depending on its Option output. Read more
Source§

fn map_some<I, O, F, M>(self, system: F) -> MapSome<Self, O>
where Self: Sized + Signal<Item = Option<I>>, I: 'static, O: Clone + Send + Sync + 'static, F: IntoSystem<In<I>, O, M> + Send + Sync + 'static,

If this Signal outputs Some, output the System (which takes In the Some value) result wrapped in Some, otherwise output None. Read more
Source§

fn map_some_in<I, O, F>(self, function: F) -> MapSome<Self, O>
where Self: Sized + Signal<Item = Option<I>>, I: 'static, O: Clone + Send + Sync + 'static, F: FnMut(I) -> O + Send + Sync + 'static,

If this Signal outputs Some, output the FnMut (which takes In the Some value) result wrapped in Some, otherwise output None. Read more
Source§

fn map_none<I, O, F, M>(self, none_system: F) -> MapNone<Self, O>
where Self: Sized + Signal<Item = Option<I>>, I: 'static, O: Clone + Send + Sync + 'static, F: IntoSystem<In<()>, O, M> + Send + Sync + 'static,

If this Signal outputs None, output the System result wrapped in Some, otherwise output None. Read more
Source§

fn map_none_in<I, O, F>(self, function: F) -> MapNone<Self, O>
where Self: Sized + Signal<Item = Option<I>>, I: 'static, O: Clone + Send + Sync + 'static, F: FnMut() -> O + Send + Sync + 'static,

If this Signal outputs None, output the FnMut result wrapped in Some, otherwise output None. Read more
Source§

fn to_signal_vec<T>(self) -> ToSignalVec<Self>
where Self: Sized + Signal<Item = Vec<T>>, T: PartialEq + Clone + Send + Sync + 'static,

Transforms this Signal’s Vec output into the corresponding SignalVec. Requires that the Vec items be PartialEq so the Vec can be .dedupe-ed to prevent sending a full VecDiff::Replace every frame, which would be akin to immediate mode. Read more
Source§

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

Adds debug logging to this Signal’s ouptut. Read more
Source§

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

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

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

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

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

Assign a schedule to this signal chain. Read more
Source§

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

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

impl<S> SignalTaskExt for S
where S: Signal + Send + Sync + 'static,

Source§

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

Convert this signal 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> SignalDynClone for T
where T: Signal + 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,