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.
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.