Struct QualifiedProcedureName
pub struct QualifiedProcedureName { /* private fields */ }Expand description
Represents a qualified procedure name, e.g. std::math::u64::add, parsed into it’s
constituent Path and ProcedureName components.
A qualified procedure name can be context-sensitive, i.e. the module path might refer to an imported
Implementations§
§impl QualifiedProcedureName
impl QualifiedProcedureName
pub fn new(
module: impl AsRef<Path>,
name: ProcedureName,
) -> QualifiedProcedureName
pub fn new( module: impl AsRef<Path>, name: ProcedureName, ) -> QualifiedProcedureName
Create a new QualifiedProcedureName with the given fully-qualified module path and procedure name.
pub fn with_span(self, span: SourceSpan) -> QualifiedProcedureName
pub fn as_path(&self) -> &Path
pub fn as_path(&self) -> &Path
Get this QualifiedProcedureName as a Path
pub fn to_spanned_path(&self) -> Span<&Path>
pub fn to_spanned_path(&self) -> Span<&Path>
Get this QualifiedProcedureName as a Span<&Path>
pub fn into_inner(self) -> Arc<Path>
Methods from Deref<Target = Path>§
pub const MAX_COMPONENT_LENGTH: usize
pub const EMPTY: &'static Path
pub const KERNEL_PATH: &'static str = "$kernel"
pub const ABSOLUTE_KERNEL_PATH: &'static str = "::$kernel"
pub const KERNEL: &'static Path
pub const EXEC_PATH: &'static str = "$exec"
pub const ABSOLUTE_EXEC_PATH: &'static str = "::$exec"
pub const EXEC: &'static Path
pub fn as_str(&self) -> &str
pub fn to_path_buf(&self) -> PathBuf
pub fn to_path_buf(&self) -> PathBuf
pub fn is_absolute(&self) -> bool
pub fn is_absolute(&self) -> bool
Returns true if this path is an absolute path
pub fn to_absolute(&self) -> Cow<'_, Path>
pub fn to_absolute(&self) -> Cow<'_, Path>
Make this path absolute, if not already
NOTE: This does not resolve the path, it simply ensures the path has the root prefix
pub fn to_relative(&self) -> &Path
pub fn to_relative(&self) -> &Path
Strip the root prefix from this path, if it has one.
pub fn components(&self) -> Iter<'_> ⓘ
pub fn components(&self) -> Iter<'_> ⓘ
Returns an iterator over all components of the path.
pub fn first(&self) -> Option<&str>
pub fn first(&self) -> Option<&str>
Get the first non-root component of this path as a str
Returns None if the path is empty, or consists only of the root prefix.
pub fn last(&self) -> Option<&str>
pub fn last(&self) -> Option<&str>
Get the first non-root component of this path as a str
Returns None if the path is empty, or consists only of the root prefix.
pub fn split_first(&self) -> Option<(&str, &Path)>
pub fn split_first(&self) -> Option<(&str, &Path)>
Splits this path on the first non-root component, returning it and a new Path of the remaining components.
Returns None if there are no components to split
pub fn split_last(&self) -> Option<(&str, &Path)>
pub fn split_last(&self) -> Option<(&str, &Path)>
Splits this path on the last component, returning it and a new Path of the remaining components.
Returns None if there are no components to split
pub fn is_kernel_path(&self) -> bool
pub fn is_kernel_path(&self) -> bool
Returns true if this path is for the root kernel module.
pub fn is_in_kernel(&self) -> bool
pub fn is_in_kernel(&self) -> bool
Returns true if this path is for the root kernel module or an item in it
pub fn is_exec_path(&self) -> bool
pub fn is_exec_path(&self) -> bool
Returns true if this path is for an executable module.
pub fn is_in_exec(&self) -> bool
pub fn is_in_exec(&self) -> bool
Returns true if this path is for the executable module or an item in it
pub fn starts_with<Prefix>(&self, prefix: &Prefix) -> bool
pub fn starts_with<Prefix>(&self, prefix: &Prefix) -> bool
Returns true if the current path, sans root component, starts with prefix
The matching semantics of Prefix depend on the implementation of StartsWith<Prefix>,
in particular, if Prefix is str, then the prefix is matched against the first non-root
component of self, regardless of whether the string contains path delimiters (i.e. ::).
See the StartsWith trait for more details.
pub fn starts_with_exactly<Prefix>(&self, prefix: &Prefix) -> bool
pub fn starts_with_exactly<Prefix>(&self, prefix: &Prefix) -> bool
Returns true if the current path, including root component, starts with prefix
The matching semantics of Prefix depend on the implementation of StartsWith<Prefix>,
in particular, if Prefix is str, then the prefix is matched against the first component
of self, regardless of whether the string contains path delimiters (i.e. ::).
See the StartsWith trait for more details.
pub fn strip_prefix<'a>(&'a self, prefix: &Path) -> Option<&'a Path>
pub fn strip_prefix<'a>(&'a self, prefix: &Path) -> Option<&'a Path>
Strips prefix from self, or returns None if self does not start with prefix.
NOTE: Prefixes must be exact, i.e. if you call path.strip_prefix(prefix) and path is
relative but prefix is absolute, then this will return None. The same is true if path
is absolute and prefix is relative.
pub fn join<P>(&self, other: &P) -> PathBuf
pub fn join<P>(&self, other: &P) -> PathBuf
Create an owned PathBuf with path adjoined to self.
If path is absolute, it replaces the current path.
The semantics of how other is joined to self in the resulting path depends on the
implementation of Join used. The implementation for Path and PathBuf joins all
components of other to self; while the implementation for [prim@str], string-like values, and identifiers/symbols joins just a single component. You must be careful to ensure that if you are passing a string here, that you specifically want to join it as a single component, or the resulting path may be different than you expect. It is recommended that you use Path::new(&string)` if you want to be explicit about treating a string-like value
as a multi-component path.
pub fn canonicalize(&self) -> Result<PathBuf, PathError>
pub fn canonicalize(&self) -> Result<PathBuf, PathError>
Canonicalize this path by ensuring that all components are in canonical form.
Canonical form dictates that:
- A component is quoted only if it requires quoting, and unquoted otherwise
- Is made absolute if relative and the first component is $kernel or $exec
Returns Err if the path is invalid
Trait Implementations§
§impl Arbitrary for QualifiedProcedureName
impl Arbitrary for QualifiedProcedureName
§type Parameters = ()
type Parameters = ()
arbitrary_with accepts for configuration
of the generated Strategy. Parameters must implement Default.§type Strategy = Map<(fn() -> SourceSpan, BoxedStrategy<Arc<Path>>), fn((SourceSpan, Arc<Path>)) -> QualifiedProcedureName>
type Strategy = Map<(fn() -> SourceSpan, BoxedStrategy<Arc<Path>>), fn((SourceSpan, Arc<Path>)) -> QualifiedProcedureName>
Strategy used to generate values of type Self.§fn arbitrary_with(
_top: <QualifiedProcedureName as Arbitrary>::Parameters,
) -> <QualifiedProcedureName as Arbitrary>::Strategy
fn arbitrary_with( _top: <QualifiedProcedureName as Arbitrary>::Parameters, ) -> <QualifiedProcedureName as Arbitrary>::Strategy
§impl AsRef<Path> for QualifiedProcedureName
impl AsRef<Path> for QualifiedProcedureName
§impl Clone for QualifiedProcedureName
impl Clone for QualifiedProcedureName
§fn clone(&self) -> QualifiedProcedureName
fn clone(&self) -> QualifiedProcedureName
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for QualifiedProcedureName
impl Debug for QualifiedProcedureName
§impl Deref for QualifiedProcedureName
impl Deref for QualifiedProcedureName
§impl Display for QualifiedProcedureName
impl Display for QualifiedProcedureName
§impl From<&Path> for QualifiedProcedureName
impl From<&Path> for QualifiedProcedureName
§fn from(path: &Path) -> QualifiedProcedureName
fn from(path: &Path) -> QualifiedProcedureName
§impl From<Arc<Path>> for QualifiedProcedureName
impl From<Arc<Path>> for QualifiedProcedureName
§fn from(path: Arc<Path>) -> QualifiedProcedureName
fn from(path: Arc<Path>) -> QualifiedProcedureName
§impl From<PathBuf> for QualifiedProcedureName
impl From<PathBuf> for QualifiedProcedureName
§fn from(path: PathBuf) -> QualifiedProcedureName
fn from(path: PathBuf) -> QualifiedProcedureName
§impl FromStr for QualifiedProcedureName
impl FromStr for QualifiedProcedureName
§impl Join<QualifiedProcedureName> for Path
impl Join<QualifiedProcedureName> for Path
§impl Join<QualifiedProcedureName> for PathBuf
impl Join<QualifiedProcedureName> for PathBuf
§impl Ord for QualifiedProcedureName
impl Ord for QualifiedProcedureName
§fn cmp(&self, other: &QualifiedProcedureName) -> Ordering
fn cmp(&self, other: &QualifiedProcedureName) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
§impl PartialEq for QualifiedProcedureName
impl PartialEq for QualifiedProcedureName
§impl PartialOrd for QualifiedProcedureName
impl PartialOrd for QualifiedProcedureName
§impl PrettyPrint for QualifiedProcedureName
impl PrettyPrint for QualifiedProcedureName
§fn to_pretty_string(&self) -> String
fn to_pretty_string(&self) -> String
§fn pretty_print(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn pretty_print(&self, f: &mut Formatter<'_>) -> Result<(), Error>
§impl Spanned for QualifiedProcedureName
impl Spanned for QualifiedProcedureName
fn span(&self) -> SourceSpan
§impl TryFrom<&str> for QualifiedProcedureName
impl TryFrom<&str> for QualifiedProcedureName
§impl TryFrom<String> for QualifiedProcedureName
impl TryFrom<String> for QualifiedProcedureName
impl Eq for QualifiedProcedureName
Auto Trait Implementations§
impl Freeze for QualifiedProcedureName
impl RefUnwindSafe for QualifiedProcedureName
impl Send for QualifiedProcedureName
impl Sync for QualifiedProcedureName
impl Unpin for QualifiedProcedureName
impl UnsafeUnpin for QualifiedProcedureName
impl UnwindSafe for QualifiedProcedureName
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more