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
impliesa.try_merge(b) == Ok(()) && a
was not modified; anda.try_merge(b) == Err(b)
impliesa
was not modified andb
was returned unmodified.
Required Methods§
sourcefn try_merge(&mut self, other: Self) -> Result<(), Self>
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.