Trait work_queue::TryMerge

source ·
pub trait TryMerge: Eq + Sized {
    // Required method
    fn try_merge(&mut self, other: Self) -> Result<(), Self>;
Expand description

Trait for merging context for work tasks with the same key.

Implementations must satisfy (for all a and b):

  • a == b implies a.try_merge(b) == Ok(()) && a was not modified; and
  • a.try_merge(b) == Err(b) implies a was not modified and b was returned unmodified.

Required Methods§


fn try_merge(&mut self, other: Self) -> Result<(), Self>

Attempts to try_merge other into self, returning other if such an operation is not possible.

Implementations should return Ok(()) if other was fully merged into self, or return Err(other), leaving self unchanged if the instances could not be merged.

Implementations on Foreign Types§


impl TryMerge for ()


fn try_merge(&mut self, _: ()) -> Result<(), Self>