Skip to main content

ValidMutIdempotenceFor

Trait ValidMutIdempotenceFor 

Source
pub trait ValidMutIdempotenceFor<F: FnMut(In) -> Out, In, Out, R: Retries, const WAS_MUT: bool>: Sealed<F, In, Out, R, WAS_MUT> { }
Expand description

Marker trait identifying that the idempotence property is valid for the given stream ordering.

A proof is required when the stream has retries (AtLeastOnce) and the closure mutably captures state (WAS_MUT). Definition (owned-item closures, |item: T| -> Out, e.g. map / filter_map / flat_map_*): processing an item twice in a row must (1) leave the mutably-captured state (e.g. Singleton::by_mut references) in the same final value as processing it once, and (2) return the same value both times as when processing it once. Condition (2) is required because the output stream inherits the retries: a retried element may re-emit its output, but must not emit a different one (e.g. a closure that reports whether an element is new is not idempotent even if its state update is).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<In, Out, F: Fn(In) -> Out, R: Retries> ValidMutIdempotenceFor<F, In, Out, R, false> for NotProved

Source§

impl<In, Out, F: Fn(In) -> Out, R: Retries> ValidMutIdempotenceFor<F, In, Out, R, false> for Proved

Source§

impl<In, Out, F: FnMut(In) -> Out, R: Retries> ValidMutIdempotenceFor<F, In, Out, R, true> for Proved

Source§

impl<In, Out, F: FnMut(In) -> Out> ValidMutIdempotenceFor<F, In, Out, ExactlyOnce, true> for NotProved