pub struct PathBuf { /* private fields */ }Expand description
Path to an item in a library, i.e. module, procedure, constant or type.
Implementations§
Source§impl PathBuf
Constructors
impl PathBuf
Constructors
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Get an empty PathBuf with capacity bytes allocated for the underlying path storage
Sourcepub fn new<S>(source: &S) -> Result<Self, PathError>
pub fn new<S>(source: &S) -> Result<Self, PathError>
Returns a new path created from the provided source.
A path consists of at list of components separated by :: delimiter. A path must contain
at least one component.
§Errors
Returns an error if:
- The path is empty.
- Any component of the path is empty.
- Any component is not a valid identifier (quoted or unquoted) in Miden Assembly syntax,
i.e. starts with an ASCII alphabetic character, contains only printable ASCII characters,
except for
::, which must only be used as a path separator.
Sourcepub fn into_boxed_path(self) -> Box<Path>
pub fn into_boxed_path(self) -> Box<Path>
Convert this mutable PathBuf into an owned, read-only alloc::boxed::Box<Path>
Source§impl PathBuf
Mutation
impl PathBuf
Mutation
Sourcepub fn set_parent<P>(&mut self, parent: &P)
pub fn set_parent<P>(&mut self, parent: &P)
Overrides the parent prefix of this path.
The parent prefix is the part of the path consisting of all components but the last one.
If there is only a single component in self, this function is equivalent to appending
self to parent.
Sourcepub fn push<P>(&mut self, path: &P)
pub fn push<P>(&mut self, path: &P)
Extends self with path
If path is absolute, it replaces the current path.
This function ensures that the joined path correctly delimits each path component.
Sourcepub fn pop(&mut self) -> bool
pub fn pop(&mut self) -> bool
Truncates self to Path::parent.
Returns false if self.parent() is None, otherwise true.
Methods from Deref<Target = Path>§
pub const MAX_COMPONENT_LENGTH: usize = 255usize
pub const EMPTY: &Path
pub const KERNEL_PATH: &str = "$kernel"
pub const ABSOLUTE_KERNEL_PATH: &str = "::$kernel"
pub const KERNEL: &Path
pub const EXEC_PATH: &str = "$exec"
pub const ABSOLUTE_EXEC_PATH: &str = "::$exec"
pub const EXEC: &Path
pub fn as_str(&self) -> &str
Sourcepub fn to_path_buf(&self) -> PathBuf
pub fn to_path_buf(&self) -> PathBuf
Sourcepub fn char_len(&self) -> usize
pub fn char_len(&self) -> usize
Return the size of the path in chars when displayed as a string
Sourcepub fn byte_len(&self) -> usize
pub fn byte_len(&self) -> usize
Return the size of the path in bytes when displayed as a string
Sourcepub fn is_absolute(&self) -> bool
pub fn is_absolute(&self) -> bool
Returns true if this path is an absolute path
Sourcepub 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
Sourcepub fn to_relative(&self) -> &Path
pub fn to_relative(&self) -> &Path
Strip the root prefix from this path, if it has one.
Sourcepub fn components(&self) -> Iter<'_> ⓘ
pub fn components(&self) -> Iter<'_> ⓘ
Returns an iterator over all components of the path.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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
Sourcepub 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
Sourcepub fn is_kernel_path(&self) -> bool
pub fn is_kernel_path(&self) -> bool
Returns true if this path is for the root kernel module.
Sourcepub 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
Sourcepub fn is_exec_path(&self) -> bool
pub fn is_exec_path(&self) -> bool
Returns true if this path is for an executable module.
Sourcepub fn starts_with<Prefix>(&self, prefix: &Prefix) -> boolwhere
Prefix: ?Sized,
Self: StartsWith<Prefix>,
pub fn starts_with<Prefix>(&self, prefix: &Prefix) -> boolwhere
Prefix: ?Sized,
Self: StartsWith<Prefix>,
Returns true if the current path, sans root component, starts with prefix
Sourcepub fn starts_with_exactly<Prefix>(&self, prefix: &Prefix) -> boolwhere
Prefix: ?Sized,
Self: StartsWith<Prefix>,
pub fn starts_with_exactly<Prefix>(&self, prefix: &Prefix) -> boolwhere
Prefix: ?Sized,
Self: StartsWith<Prefix>,
Returns true if the current path, including root component, starts with prefix
Trait Implementations§
Source§impl<'a> AddAssign<&'a Ident> for PathBuf
impl<'a> AddAssign<&'a Ident> for PathBuf
Source§fn add_assign(&mut self, rhs: &'a Ident)
fn add_assign(&mut self, rhs: &'a Ident)
+= operation. Read moreSource§impl<'a> AddAssign<&'a Path> for PathBuf
impl<'a> AddAssign<&'a Path> for PathBuf
Source§fn add_assign(&mut self, rhs: &'a Path)
fn add_assign(&mut self, rhs: &'a Path)
+= operation. Read moreSource§impl<'a> AddAssign<&'a ProcedureName> for PathBuf
impl<'a> AddAssign<&'a ProcedureName> for PathBuf
Source§fn add_assign(&mut self, rhs: &'a ProcedureName)
fn add_assign(&mut self, rhs: &'a ProcedureName)
+= operation. Read moreSource§impl<'a> AddAssign<&'a str> for PathBuf
impl<'a> AddAssign<&'a str> for PathBuf
Source§fn add_assign(&mut self, rhs: &'a str)
fn add_assign(&mut self, rhs: &'a str)
+= operation. Read moreSource§impl Deserializable for PathBuf
impl Deserializable for PathBuf
Source§fn read_from<R: ByteReader>(
source: &mut R,
) -> Result<Self, DeserializationError>
fn read_from<R: ByteReader>( source: &mut R, ) -> Result<Self, DeserializationError>
source, attempts to deserialize these bytes
into Self, and returns the result. Read moreSource§fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
Source§impl From<PathBuf> for QualifiedProcedureName
impl From<PathBuf> for QualifiedProcedureName
Source§impl Ord for PathBuf
impl Ord for PathBuf
Source§impl PartialOrd for PathBuf
impl PartialOrd for PathBuf
Source§impl Serializable for PathBuf
impl Serializable for PathBuf
Source§fn write_into<W: ByteWriter>(&self, target: &mut W)
fn write_into<W: ByteWriter>(&self, target: &mut W)
self into bytes and writes these bytes into the target.Source§fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
impl Eq for PathBuf
impl StructuralPartialEq for PathBuf
Auto Trait Implementations§
impl Freeze for PathBuf
impl RefUnwindSafe for PathBuf
impl Send for PathBuf
impl Sync for PathBuf
impl Unpin for PathBuf
impl UnwindSafe for PathBuf
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§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 moreSource§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