pub struct Path { /* private fields */ }Implementations§
Source§impl Path
Conversions
impl Path
Conversions
Sourcepub const MAX_COMPONENT_LENGTH: usize
pub const MAX_COMPONENT_LENGTH: usize
Path components must be 255 bytes or less
Sourcepub const EMPTY: &'static Path
pub const EMPTY: &'static Path
An empty path for use as a default value, placeholder, comparisons, etc.
Sourcepub const KERNEL_PATH: &'static str = "$kernel"
pub const KERNEL_PATH: &'static str = "$kernel"
Base kernel path.
pub const ABSOLUTE_KERNEL_PATH: &'static str = "::$kernel"
pub const KERNEL: &'static Path
pub const ABSOLUTE_EXEC_PATH: &'static str = "::$exec"
pub const EXEC: &'static Path
pub fn new<S>(path: &S) -> &Path
pub fn from_mut(path: &mut str) -> &mut Path
Sourcepub fn validate(path: &str) -> Result<&Path, PathError>
pub fn validate(path: &str) -> Result<&Path, PathError>
Verify that path meets all the requirements for a valid Path
Sourcepub const fn kernel_path() -> &'static Path
pub const fn kernel_path() -> &'static Path
Get a Path corresponding to Self::KERNEL_PATH
Sourcepub const fn exec_path() -> &'static Path
pub const fn exec_path() -> &'static Path
Get a Path corresponding to Self::EXEC_PATH
pub const fn as_str(&self) -> &str
pub fn as_mut_str(&mut self) -> &mut str
Sourcepub fn to_path_buf(&self) -> PathBuf
pub fn to_path_buf(&self) -> PathBuf
Source§impl Path
Accesssors
impl Path
Accesssors
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) -> bool
pub fn starts_with<Prefix>(&self, prefix: &Prefix) -> bool
Returns true if the current path, sans root component, starts with prefix
Sourcepub 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
Trait Implementations§
Source§impl AsRef<Path> for QualifiedProcedureName
impl AsRef<Path> for QualifiedProcedureName
Source§impl From<&Path> for QualifiedProcedureName
impl From<&Path> for QualifiedProcedureName
Source§fn from(path: &Path) -> QualifiedProcedureName
fn from(path: &Path) -> QualifiedProcedureName
Source§impl PartialOrd for Path
impl PartialOrd for Path
Source§impl Serializable for Path
impl Serializable for Path
Source§fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
self into bytes and writes these bytes into the target.Source§fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
Source§impl StartsWith<Path> for Path
impl StartsWith<Path> for Path
Source§fn starts_with(&self, prefix: &Path) -> bool
fn starts_with(&self, prefix: &Path) -> bool
prefixSource§fn starts_with_exactly(&self, prefix: &Path) -> bool
fn starts_with_exactly(&self, prefix: &Path) -> bool
prefixSource§impl StartsWith<str> for Path
impl StartsWith<str> for Path
Source§fn starts_with(&self, prefix: &str) -> bool
fn starts_with(&self, prefix: &str) -> bool
prefixSource§fn starts_with_exactly(&self, prefix: &str) -> bool
fn starts_with_exactly(&self, prefix: &str) -> bool
prefixSource§impl ToOwned for Path
impl ToOwned for Path
impl Eq for Path
impl StructuralPartialEq for Path
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl !Sized for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.