Trait moniker::MonikerBase
source · pub trait MonikerBase: Default + Eq + PartialEq + Debug + Clone + Hash + Display {
type Part: ChildNameBase;
Show 15 methods
// Required methods
fn new(path: Vec<Self::Part>) -> Self;
fn path(&self) -> &Vec<Self::Part>;
fn path_mut(&mut self) -> &mut Vec<Self::Part>;
// Provided methods
fn parse<T: AsRef<str>>(path: &[T]) -> Result<Self, MonikerError> { ... }
fn parse_str(input: &str) -> Result<Self, MonikerError> { ... }
fn concat<T: MonikerBase<Part = Self::Part>>(&self, other: &T) -> Self { ... }
fn has_prefix<S: MonikerBase<Part = Self::Part>>(&self, prefix: &S) -> bool { ... }
fn root() -> Self { ... }
fn leaf(&self) -> Option<&Self::Part> { ... }
fn is_root(&self) -> bool { ... }
fn parent(&self) -> Option<Self> { ... }
fn child(&self, child: Self::Part) -> Self { ... }
fn strip_prefix<T: MonikerBase<Part = Self::Part>>(
&self,
prefix: &T
) -> Result<Self, MonikerError> { ... }
fn compare(&self, other: &Self) -> Ordering { ... }
fn format(&self, f: &mut Formatter<'_>) -> Result { ... }
}
Expand description
MonikerBase is the common trait for both InstancedMoniker and Moniker concrete types.
MonikerBase describes the identity of a component instance in terms of its path relative to the root of the component instance tree.
Required Associated Types§
type Part: ChildNameBase
Required Methods§
fn new(path: Vec<Self::Part>) -> Self
fn path(&self) -> &Vec<Self::Part>
fn path_mut(&mut self) -> &mut Vec<Self::Part>
Provided Methods§
fn parse<T: AsRef<str>>(path: &[T]) -> Result<Self, MonikerError>
fn parse_str(input: &str) -> Result<Self, MonikerError>
sourcefn concat<T: MonikerBase<Part = Self::Part>>(&self, other: &T) -> Self
fn concat<T: MonikerBase<Part = Self::Part>>(&self, other: &T) -> Self
Concatenates other onto the end of this moniker.
sourcefn has_prefix<S: MonikerBase<Part = Self::Part>>(&self, prefix: &S) -> bool
fn has_prefix<S: MonikerBase<Part = Self::Part>>(&self, prefix: &S) -> bool
Indicates whether this moniker is prefixed by prefix.
fn root() -> Self
fn leaf(&self) -> Option<&Self::Part>
fn is_root(&self) -> bool
fn parent(&self) -> Option<Self>
fn child(&self, child: Self::Part) -> Self
sourcefn strip_prefix<T: MonikerBase<Part = Self::Part>>(
&self,
prefix: &T
) -> Result<Self, MonikerError>
fn strip_prefix<T: MonikerBase<Part = Self::Part>>( &self, prefix: &T ) -> Result<Self, MonikerError>
Strips the moniker parts in prefix from the beginning of this moniker.
fn compare(&self, other: &Self) -> Ordering
fn format(&self, f: &mut Formatter<'_>) -> Result
Object Safety§
This trait is not object safe.