pub struct CheckedTarget<'a>(/* private fields */);
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<'b> Extend<(&'b str, &'b str)> for CheckedTarget<'_>
impl<'b> Extend<(&'b str, &'b str)> for CheckedTarget<'_>
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> Freeze for CheckedTarget<'a>
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