work_queue

Trait 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§

Source

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TryMerge for ()

Source§

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

Implementors§