Struct MapOkWith

Source
pub struct MapOkWith<S, C, F>(/* private fields */);

Implementations§

Source§

impl<S, C, F> MapOkWith<S, C, F>

Source

pub fn new(s: S, c: C, f: F) -> MapOkWith<S, C, F>

Trait Implementations§

Source§

impl<S, C, F> Collect for MapOkWith<S, C, F>
where S: Collect, Option<(C, StaticCollect<F>)>: Collect,

Source§

fn needs_trace() -> bool

As an optimization, if this type can never hold a Gc pointer and trace is unnecessary to call, you may implement this method and return false. The default implementation returns true, signaling that Collect::trace must be called.
Source§

fn trace(&self, cc: CollectionContext<'_>)

Must call Collect::trace on all held Gc pointers. If this type holds inner types that implement Collect, a valid implementation would simply call Collect::trace on all the held values to ensure this.
Source§

impl<S: Debug, C: Debug, F: Debug> Debug for MapOkWith<S, C, F>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'gc, S, C, F, I, E, R> Sequence<'gc> for MapOkWith<S, C, F>
where S: Sequence<'gc, Output = Result<I, E>>, C: Collect, F: 'static + FnOnce(C, I) -> R,

Source§

type Output = Result<R, E>

Source§

fn step(&mut self, mc: MutationContext<'gc, '_>) -> Option<Self::Output>

Auto Trait Implementations§

§

impl<S, C, F> Freeze for MapOkWith<S, C, F>
where S: Freeze, C: Freeze, F: Freeze,

§

impl<S, C, F> RefUnwindSafe for MapOkWith<S, C, F>

§

impl<S, C, F> Send for MapOkWith<S, C, F>
where S: Send, C: Send, F: Send,

§

impl<S, C, F> Sync for MapOkWith<S, C, F>
where S: Sync, C: Sync, F: Sync,

§

impl<S, C, F> Unpin for MapOkWith<S, C, F>
where S: Unpin, C: Unpin, F: Unpin,

§

impl<S, C, F> UnwindSafe for MapOkWith<S, C, F>
where S: UnwindSafe, C: UnwindSafe, F: UnwindSafe,

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.

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<'gc, T> SequenceExt<'gc> for T
where T: Sequence<'gc>,

Source§

fn map<F, R>(self, f: F) -> Map<Self, F>
where F: 'static + FnOnce(Self::Output) -> R,

Map a function over result of this sequence. Read more
Source§

fn map_with<C, F, R>(self, c: C, f: F) -> MapWith<Self, C, F>
where C: Collect, F: 'static + FnOnce(C, Self::Output) -> R,

Equivalent to SequencExt::map but calls the function with a context parameter. Read more
Source§

fn then<F, R>(self, f: F) -> Then<'gc, Self, F>
where Self::Output: Collect, F: 'static + FnOnce(MutationContext<'gc, '_>, Self::Output) -> R,

Execute a separate sequence step after this sequence completes. Read more
Source§

fn then_with<C, F, R>(self, c: C, f: F) -> ThenWith<'gc, Self, C, F>
where C: Collect, Self::Output: Collect, F: 'static + FnOnce(MutationContext<'gc, '_>, C, Self::Output) -> R,

Equivalent to SequenceExt::then but calls the function with the given context parameter. Read more
Source§

fn chain<F, R>(self, f: F) -> Flatten<'gc, Then<'gc, Self, F>>
where Self::Output: Collect, F: 'static + FnOnce(MutationContext<'gc, '_>, Self::Output) -> R, R: Sequence<'gc>,

Call a function on the result of this sequence, producing a new sequence to run. Read more
Source§

fn chain_with<C, F, R>( self, c: C, f: F, ) -> Flatten<'gc, ThenWith<'gc, Self, C, F>>
where C: Collect, Self::Output: Collect, F: 'static + FnOnce(MutationContext<'gc, '_>, C, Self::Output) -> R, R: Sequence<'gc>,

Equivalent to SequenceExt::chain but calls the function with the given context parameter. Read more
Source§

fn flatten(self) -> Flatten<'gc, Self>
where Self::Output: Sequence<'gc>,

If this sequence results in another sequence, this combinator flattens them so that they are executed one after another.
Source§

fn boxed(self) -> Box<dyn Sequence<'gc, Output = Self::Output> + 'gc>
where Self: 'gc,

Turn this sequence into a boxed sequence type. Read more
Source§

impl<'gc, T, I, E> SequenceResultExt<'gc, I, E> for T
where T: Sequence<'gc, Output = Result<I, E>>,

Source§

fn map_ok<F, R>(self, f: F) -> MapOk<Self, F>
where F: 'static + FnOnce(I) -> R,

Map a function over the result of this sequence if it is successful. Read more
Source§

fn map_ok_with<C, F, R>(self, c: C, f: F) -> MapOkWith<Self, C, F>
where F: 'static + FnOnce(C, I) -> R,

Equivalent to SequenceResultExt::map_ok, but takes a context parameter.
Source§

fn map_err<F, R>(self, f: F) -> MapError<Self, F>
where F: 'static + FnOnce(E) -> R,

Map a function over the error result of this sequence, if it errors. Read more
Source§

fn and_then<F, R>(self, f: F) -> AndThen<Self, F, I>
where I: Collect, F: 'static + FnOnce(MutationContext<'gc, '_>, I) -> Result<R, E>,

Execute another sequence step after this sequence completes successfully. Read more
Source§

fn and_then_with<C, F, R>(self, c: C, f: F) -> AndThenWith<Self, C, F, I>
where C: Collect, I: Collect, F: 'static + FnOnce(MutationContext<'gc, '_>, C, I) -> Result<R, E>,

Equivalent to SequenceResultExt::and_then, but calls the function with the given context parameter.
Source§

fn and_chain<F, R, I2>(self, f: F) -> FlattenOk<AndThen<Self, F, I>, R>
where I: Collect, F: 'static + FnOnce(MutationContext<'gc, '_>, I) -> Result<R, E>, R: Sequence<'gc, Output = Result<I2, E>>,

Call a function on the result of this sequence, producing a new sequence to run. Read more
Source§

fn and_chain_with<C, F, R, I2>( self, c: C, f: F, ) -> FlattenOk<AndThenWith<Self, C, F, I>, R>
where C: Collect, I: Collect, F: 'static + FnOnce(MutationContext<'gc, '_>, C, I) -> Result<R, E>, R: Sequence<'gc, Output = Result<I2, E>>,

Equivalent to SequenceResultExt::and_then, but calls the function with the given context parameter.
Source§

fn flatten_ok<I2>(self) -> FlattenOk<Self, I>
where I: Sequence<'gc, Output = Result<I2, E>>,

Similar to SequenceExt::flatten, but this sequence must result in an Ok(next_sequence).
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.