pub fn add<A: Arena>(self, arena: &'a A, x: K, data: V) -> Self {
        match self {
            Map(None) => {
                let node = Node(Self::empty(), x, data, Self::empty(), 1);
                Map(Some(arena.alloc(node)))
            }
            Map(Some(Node(ref l, v, d, r, h))) => match x.cmp(v) {
                Ordering::Equal => {
                    let node = Node(*l, x, data, *r, *h);
                    Map(Some(arena.alloc(node)))
                }
                Ordering::Less => bal(arena, l.add(arena, x, data), v.clone(), d.clone(), *r),
                Ordering::Greater => bal(arena, *l, v.clone(), d.clone(), r.add(arena, x, data)),
            },
        }
    }
/// Return a map containing the same entries as before,
/// plus a new entry. If the key was already bound,
/// its previous entry disappears.
Return a map containing the same entries as before,
plus a new entry. If the key was already bound,
its previous entry disappears.
Return a map containing the same entries as before plus a new entry . If the key was already bound its previous entry disappears .
pub fn add<A: Arena>(self, arena: &'a A, x: K, data: V) -> Self {
        match self {
            Map(None) => {
                let node = Node(Self::empty(), x, data, Self::empty(), 1);
                Map(Some(arena.alloc(node)))
            }
            Map(Some(Node(ref l, v, d, r, h))) => match x.cmp(v) {
                Ordering::Equal => {
                    let node = Node(*l, x, data, *r, *h);
                    Map(Some(arena.alloc(node)))
                }
                Ordering::Less => bal(arena, l.add(arena, x, data), v.clone(), d.clone(), *r),
                Ordering::Greater => bal(arena, *l, v.clone(), d.clone(), r.add(arena, x, data)),
            },
        }
    }
pub fn add < A : Arena > ( self , arena : & ' a A , x : K , data : V ) -> Self { match self { Map ( None ) => { let node = Node ( Self :: empty ( ) , x , data , Self :: empty ( ) , 1 ) ; Map ( Some ( arena . alloc ( node ) ) ) } Map ( Some ( Node ( ref l , v , d , r , h ) ) ) => match x . cmp ( v ) { Ordering :: Equal => { let node = Node ( * l , x , data , * r , * h ) ; Map ( Some ( arena . alloc ( node ) ) ) } Ordering :: Less => bal ( arena , l . add ( arena , x , data ) , v . clone ( ) , d . clone ( ) , * r ) , Ordering :: Greater => bal ( arena , * l , v . clone ( ) , d . clone ( ) , r . add ( arena , x , data ) ) , } , } }
Return a map containing the same entries as before,
plus a new entry.
Return a map containing the same entries as before plus a new entry .
self
arena
&'a A
x
K
data
V
self
arena
&'a A
x
K
data
V