pub struct SimplePath { /* private fields */ }Expand description
Represents a syntactic path composed of ::-separated segments.
Implementations§
Source§impl SimplePath
impl SimplePath
Sourcepub fn new<I, S>(segments: I) -> Self
pub fn new<I, S>(segments: I) -> Self
Builds a path from iterator segments.
§Examples
use whitaker_common::path::SimplePath;
let path = SimplePath::new(["tokio", "test"]);
assert_eq!(path.segments(), &["tokio", "test"]);Sourcepub fn parse(path: &str) -> Self
pub fn parse(path: &str) -> Self
Parses a Rust path from its textual representation.
Empty segments produced by leading, trailing, or repeated separators are discarded.
§Examples
use whitaker_common::path::SimplePath;
let parsed = SimplePath::from("tokio::test");
assert_eq!(parsed.segments(), &["tokio", "test"]);
let compact = SimplePath::parse("::test::");
assert_eq!(compact.segments(), &["test"]);Trait Implementations§
Source§impl Clone for SimplePath
impl Clone for SimplePath
Source§fn clone(&self) -> SimplePath
fn clone(&self) -> SimplePath
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SimplePath
impl Debug for SimplePath
Source§impl Display for SimplePath
impl Display for SimplePath
impl Eq for SimplePath
Source§impl From<&str> for SimplePath
impl From<&str> for SimplePath
Source§impl From<String> for SimplePath
impl From<String> for SimplePath
Source§impl PartialEq for SimplePath
impl PartialEq for SimplePath
impl StructuralPartialEq for SimplePath
Auto Trait Implementations§
impl Freeze for SimplePath
impl RefUnwindSafe for SimplePath
impl Send for SimplePath
impl Sync for SimplePath
impl Unpin for SimplePath
impl UnsafeUnpin for SimplePath
impl UnwindSafe for SimplePath
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