Struct xml::namespace::CheckedTarget [] [src]

pub struct CheckedTarget<'a>(_);

A wrapper around NamespaceStack which implements Extend using put_checked().

Example


let mut nst = NamespaceStack::empty();
nst.push_empty();
nst.put("a", "urn:A");
nst.put("b", "urn:B");
nst.push_empty();
nst.put("c", "urn:C");

nst.checked_target().extend(vec![("a", "urn:Z"), ("b", "urn:B"), ("c", "urn:Y"), ("d", "urn:D")]);
assert_eq!(
    vec![("a", "urn:Z"), ("c", "urn:C"), ("d", "urn:D"), ("b", "urn:B")],
    nst.iter().collect::<Vec<_>>()
);

Compare:


nst.extend(vec![("a", "urn:Z"), ("b", "urn:B"), ("c", "urn:Y"), ("d", "urn:D")]);
assert_eq!(
    vec![("a", "urn:Z"), ("b", "urn:B"), ("c", "urn:C"), ("d", "urn:D")],
    nst.iter().collect::<Vec<_>>()
);

Trait Implementations

impl<'a, 'b> Extend<UriMapping<'b>> for CheckedTarget<'a>
[src]

fn extend<T>(&mut self, iterable: T) where T: IntoIterator<Item=UriMapping<'b>>

Extends a collection with the contents of an iterator. Read more