Skip to main content

ValidMutCommutativityFor

Trait ValidMutCommutativityFor 

Source
pub trait ValidMutCommutativityFor<F: FnMut(In) -> Out, In, Out, O: Ordering, const WAS_MUT: bool>: Sealed<F, In, Out, O, WAS_MUT> { }
Expand description

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

A proof is required when the stream is unordered and the closure mutably captures state (WAS_MUT). Definition (owned-item closures, |item: T| -> Out, e.g. map / for_each): processing any two items in either order must (1) leave the mutably-captured state (e.g. Singleton::by_mut references) in the same final value, and (2) produce the same multiset of return values. Condition (2) is required whenever the return value is observable (as in map): a closure that emits, say, a running total is not commutative even if its state update is. For ()-returning closures (as in for_each), condition (2) is trivial.

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, O: Ordering> ValidMutCommutativityFor<F, In, Out, O, false> for NotProved

Source§

impl<In, Out, F: Fn(In) -> Out, O: Ordering> ValidMutCommutativityFor<F, In, Out, O, false> for Proved

Source§

impl<In, Out, F: FnMut(In) -> Out, O: Ordering> ValidMutCommutativityFor<F, In, Out, O, true> for Proved

Source§

impl<In, Out, F: FnMut(In) -> Out> ValidMutCommutativityFor<F, In, Out, TotalOrder, true> for NotProved