Skip to main content

TryMap

Struct TryMap 

Source
pub struct TryMap<A, B, F>(/* private fields */);
Expand description

Applies a fallible closure to its input, propagating any error to abort the run with context. The try_ counterpart to Map; the closure is Fn for the same drift-safety reason (see Map).

Trait Implementations§

Source§

impl<A, B, F> Op for TryMap<A, B, F>
where A: 'static, B: Clone + 'static, F: Fn(&A) -> Result<B> + 'static,

Source§

const ACTIVATION: Activation = Activation::NONE

How this op is scheduled, declared statically so the engines can read it at wiring time rather than infer it. See Activation.
Source§

type Cfg = F

Construction-time configuration, closures included — a map’s F is its Cfg. Built at wiring, owned by the engine, handed to every lifecycle function by &mut. () for an op that needs none.
Source§

type State = ()

Per-node mutable state carried between cycles: boxed by the interpreted engine, a stack local in a compiled runner. () for a stateless op.
Source§

type In<'a> = (&'a A,)

The typed inputs for one cycle — upstream values by reference, plus a bool tick flag wherever the op needs to know which input fired ((&T, bool)). A tuple for a fixed-arity op, a slice for a variadic one, () for a source. The engine assembles it; ops never reach upstream themselves.
Source§

type Out = B

The value this op produces, i.e. what its downstream sees.
Source§

fn cycle( cfg: &mut F, _state: &mut (), input: (&A,), _ctx: &mut Ctx<'_>, ) -> Result<Tick<B>>

Run one cycle: the op’s whole semantics, and the only function that must be written. Returns Tick::Value to produce and propagate, Tick::Silent to update the value slot without waking downstream, or Tick::Quiet to do neither. Err aborts the run with node context.
Source§

fn start( cfg: &mut Self::Cfg, state: &mut Self::State, ctx: &mut Ctx<'_>, ) -> Result<()>

Called once before the first cycle. Sources use this to schedule their first activation; IO ops open resources here.
Source§

fn stop( cfg: &mut Self::Cfg, state: &mut Self::State, ctx: &mut Ctx<'_>, ) -> Result<()>

Called once after the last cycle, before teardown. Runs even if a cycle aborted the run, so ops can flush or unwind cleanly. A stop error is reported but does not mask an earlier cycle error.
Source§

fn teardown( cfg: &mut Self::Cfg, state: &mut Self::State, ctx: &mut Ctx<'_>, ) -> Result<()>

Called once at the very end of the run, after stop. The place to release resources (close sockets, files). Also runs after a cycle error.

Auto Trait Implementations§

§

impl<A, B, F> Freeze for TryMap<A, B, F>

§

impl<A, B, F> RefUnwindSafe for TryMap<A, B, F>

§

impl<A, B, F> Send for TryMap<A, B, F>

§

impl<A, B, F> Sync for TryMap<A, B, F>

§

impl<A, B, F> Unpin for TryMap<A, B, F>

§

impl<A, B, F> UnsafeUnpin for TryMap<A, B, F>

§

impl<A, B, F> UnwindSafe for TryMap<A, B, F>

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.