Trait treediff::Mutable

source ·
pub trait Mutable {
    type Key;
    type Item;

    // Required methods
    fn set(&mut self, keys: &[Self::Key], new: &Self::Item);
    fn remove(&mut self, keys: &[Self::Key]);
}
Expand description

A trait to allow changing any Value.

Required Associated Types§

source

type Key

The Key type used to find Values in a mapping.

source

type Item

The Value type itself.

Required Methods§

source

fn set(&mut self, keys: &[Self::Key], new: &Self::Item)

Set the new Value at the path identified by keys.

Intermediate container values (like HashMaps, Arrays) must be created until the last Key in keys can be modified or inserted with new.

source

fn remove(&mut self, keys: &[Self::Key])

Remove the value located at the path identified by keys.

If the value does not exist, just return. Intermediate container values must not be created.

Implementors§