Skip to main content

SystemVirtualPath

Struct SystemVirtualPath 

Source
pub struct SystemVirtualPath(/* private fields */);
Expand description

A slice of a virtual path on System (akin to str).

Implementations§

Source§

impl SystemVirtualPath

Source

pub const fn new(path: &str) -> &SystemVirtualPath

Source

pub fn to_path_buf(&self) -> SystemVirtualPathBuf

Converts the path to an owned SystemVirtualPathBuf.

Source

pub fn extension(&self) -> Option<&str>

Extracts the file extension, if possible.

§Examples
use ruff_db::system::SystemVirtualPath;

assert_eq!(None, SystemVirtualPath::new("untitled:Untitled-1").extension());
assert_eq!("ipynb", SystemVirtualPath::new("untitled:Untitled-1.ipynb").extension().unwrap());
assert_eq!("ipynb", SystemVirtualPath::new("vscode-notebook-cell:Untitled-1.ipynb").extension().unwrap());

See Path::extension for more details.

Source

pub fn as_str(&self) -> &str

Returns the path as a string slice.

Trait Implementations§

Source§

impl AsRef<SystemVirtualPath> for SystemVirtualPathBuf

Source§

fn as_ref(&self) -> &SystemVirtualPath

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<SystemVirtualPath> for SystemVirtualPath

Source§

fn as_ref(&self) -> &SystemVirtualPath

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<SystemVirtualPath> for str

Source§

fn as_ref(&self) -> &SystemVirtualPath

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<SystemVirtualPath> for String

Source§

fn as_ref(&self) -> &SystemVirtualPath

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<SystemVirtualPath> for SystemVirtualPathBuf

Source§

fn borrow(&self) -> &SystemVirtualPath

Immutably borrows from an owned value. Read more
Source§

impl Clone for Box<SystemVirtualPath>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SystemVirtualPath

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SystemVirtualPath

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SystemVirtualPath

Source§

impl From<&SystemVirtualPath> for FilePath

Source§

fn from(value: &SystemVirtualPath) -> Self

Converts to this type from the input type.
Source§

impl From<&SystemVirtualPath> for Box<SystemVirtualPath>

Source§

fn from(path: &SystemVirtualPath) -> Self

Converts to this type from the input type.
Source§

impl From<SystemVirtualPathBuf> for Box<SystemVirtualPath>

Source§

fn from(path: SystemVirtualPathBuf) -> Self

Converts to this type from the input type.
Source§

impl GetSize for Box<SystemVirtualPath>

Source§

fn get_heap_size_with_tracker<T: GetSizeTracker>( &self, tracker: T, ) -> (usize, T)

Determines how many bytes this object occupies inside the heap while using a tracker. Read more
Source§

fn get_stack_size() -> usize

Determines how may bytes this object occupies inside the stack. Read more
Source§

fn get_heap_size(&self) -> usize

Determines how many bytes this object occupies inside the heap. Read more
Source§

fn get_size(&self) -> usize

Determines the total size of the object. Read more
Source§

fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)
where T: GetSizeTracker,

Determines the total size of the object while using a tracker. Read more
Source§

impl Hash for SystemVirtualPath

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
Source§

impl Ord for SystemVirtualPath

Source§

fn cmp(&self, other: &SystemVirtualPath) -> Ordering

This method returns an Ordering between self and other. Read more
Source§

impl PartialEq for SystemVirtualPath

Source§

fn eq(&self, other: &SystemVirtualPath) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for SystemVirtualPath

Source§

fn partial_cmp(&self, other: &SystemVirtualPath) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for SystemVirtualPath

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more