Struct xml::namespace::CheckedTarget
source · pub struct CheckedTarget<'a>(_);
Expand description
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§
source§impl<'a, 'b> Extend<(&'b str, &'b str)> for CheckedTarget<'a>
impl<'a, 'b> Extend<(&'b str, &'b str)> for CheckedTarget<'a>
source§fn extend<T>(&mut self, iterable: T)where
T: IntoIterator<Item = UriMapping<'b>>,
fn extend<T>(&mut self, iterable: T)where T: IntoIterator<Item = UriMapping<'b>>,
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Auto Trait Implementations§
impl<'a> RefUnwindSafe for CheckedTarget<'a>
impl<'a> Send for CheckedTarget<'a>
impl<'a> Sync for CheckedTarget<'a>
impl<'a> Unpin for CheckedTarget<'a>
impl<'a> !UnwindSafe for CheckedTarget<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more