pub struct Name {
pub components: Vec<NameComponent>,
}Expand description
A hierarchical NDN name: an ordered sequence of NameComponents.
Names identify both Interests and the Data that satisfies them, and are
usually written and read as a ndn:/a/b/c-style URI – see
Name::from_str and Name::to_uri. Name implements Ord so
names can be sorted and compared, by comparing their encoded bytes.
Fields§
§components: Vec<NameComponent>The name’s components, in order from least to most specific.
Implementations§
Source§impl Name
impl Name
Sourcepub fn from_str(s: &str) -> Result<Self>
pub fn from_str(s: &str) -> Result<Self>
Parses a name from its URI form, e.g. /hello/world or
ndn:/hello/world. The leading ndn: scheme is optional.
Sourcepub fn iter(&self) -> impl Iterator<Item = &NameComponent>
pub fn iter(&self) -> impl Iterator<Item = &NameComponent>
Iterates over the name’s components.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut NameComponent>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut NameComponent>
Iterates mutably over the name’s components.
Sourcepub fn into_iter(self) -> impl Iterator<Item = NameComponent>
pub fn into_iter(self) -> impl Iterator<Item = NameComponent>
Consumes the name, iterating over its components by value.
Sourcepub fn has_prefix(&self, prefix: &Name) -> bool
pub fn has_prefix(&self, prefix: &Name) -> bool
Returns whether prefix is a prefix of this name, component by component.
Sourcepub fn remove_prefix(&mut self, prefix: &Name) -> bool
pub fn remove_prefix(&mut self, prefix: &Name) -> bool
Removes prefix from the front of this name if it’s actually a
prefix, returning whether anything was removed.
Trait Implementations§
impl Eq for Name
Source§impl Extend<NameComponent> for Name
impl Extend<NameComponent> for Name
Source§fn extend<T: IntoIterator<Item = NameComponent>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = NameComponent>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl From<NameComponent> for Name
impl From<NameComponent> for Name
Source§fn from(value: NameComponent) -> Self
fn from(value: NameComponent) -> Self
Source§impl FromIterator<NameComponent> for Name
impl FromIterator<NameComponent> for Name
Source§fn from_iter<T: IntoIterator<Item = NameComponent>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = NameComponent>>(iter: T) -> Self
Source§impl Ord for Name
impl Ord for Name
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Name
impl PartialOrd for Name
impl StructuralPartialEq for Name
Source§impl Tlv for Name
impl Tlv for Name
Source§fn inner_size(&self) -> usize
fn inner_size(&self) -> usize
Source§fn critical() -> bool
fn critical() -> bool
tlv_criticalAuto Trait Implementations§
impl Freeze for Name
impl RefUnwindSafe for Name
impl Send for Name
impl Sync for Name
impl Unpin for Name
impl UnsafeUnpin for Name
impl UnwindSafe for Name
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more