pub enum FilePath {
System(Box<SystemPath>),
SystemVirtual(Box<SystemVirtualPath>),
Vendored(Box<VendoredPath>),
}Expand description
Path to a file.
The path abstracts that files in Ruff can come from different sources:
- a file stored on the host system.
- a virtual file stored on the host system.
- a vendored file stored in the vendored file system.
Variants§
System(Box<SystemPath>)
Path to a file on the host system.
SystemVirtual(Box<SystemVirtualPath>)
Path to a virtual file on the host system.
Vendored(Box<VendoredPath>)
Path to a file vendored as part of Ruff. Stored in the vendored file system.
Implementations§
Source§impl FilePath
impl FilePath
Sourcepub fn system(path: impl AsRef<SystemPath>) -> Self
pub fn system(path: impl AsRef<SystemPath>) -> Self
Create a new path to a file on the file system.
pub fn as_system_path(&self) -> Option<&SystemPath>
Sourcepub const fn is_system_path(&self) -> bool
pub const fn is_system_path(&self) -> bool
Returns true if the path is a file system path that points to a path on disk.
Sourcepub const fn is_system_virtual_path(&self) -> bool
pub const fn is_system_virtual_path(&self) -> bool
Returns true if the path is a file system path that is virtual i.e., it doesn’t exists on
disk.
Sourcepub const fn is_vendored_path(&self) -> bool
pub const fn is_vendored_path(&self) -> bool
Returns true if the path is a vendored path.
pub fn as_vendored_path(&self) -> Option<&VendoredPath>
Sourcepub fn to_file(&self, db: &dyn Db) -> Option<File>
pub fn to_file(&self, db: &dyn Db) -> Option<File>
Interns a virtual file system path and returns a salsa File ingredient.
Returns Some if a file for path exists and is accessible by the user. Returns None otherwise.
See system_path_to_file or vendored_path_to_file if you always have either a file
system or vendored path.
pub fn extension(&self) -> Option<&str>
Trait Implementations§
impl Eq for FilePath
Source§impl From<&SystemPath> for FilePath
impl From<&SystemPath> for FilePath
Source§fn from(value: &SystemPath) -> Self
fn from(value: &SystemPath) -> Self
Source§impl From<&SystemVirtualPath> for FilePath
impl From<&SystemVirtualPath> for FilePath
Source§fn from(value: &SystemVirtualPath) -> Self
fn from(value: &SystemVirtualPath) -> Self
Source§impl From<&VendoredPath> for FilePath
impl From<&VendoredPath> for FilePath
Source§fn from(value: &VendoredPath) -> Self
fn from(value: &VendoredPath) -> Self
Source§impl From<SystemPathBuf> for FilePath
impl From<SystemPathBuf> for FilePath
Source§fn from(value: SystemPathBuf) -> Self
fn from(value: SystemPathBuf) -> Self
Source§impl From<SystemVirtualPathBuf> for FilePath
impl From<SystemVirtualPathBuf> for FilePath
Source§fn from(value: SystemVirtualPathBuf) -> Self
fn from(value: SystemVirtualPathBuf) -> Self
Source§impl From<VendoredPathBuf> for FilePath
impl From<VendoredPathBuf> for FilePath
Source§fn from(value: VendoredPathBuf) -> Self
fn from(value: VendoredPathBuf) -> Self
Source§impl GetSize for FilePath
impl GetSize for FilePath
Source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Source§fn get_heap_size_with_tracker<TRACKER: GetSizeTracker>(
&self,
tracker: TRACKER,
) -> (usize, TRACKER)
fn get_heap_size_with_tracker<TRACKER: GetSizeTracker>( &self, tracker: TRACKER, ) -> (usize, TRACKER)
tracker. Read moreSource§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Source§fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
tracker. Read moreSource§impl PartialEq<FilePath> for SystemPath
impl PartialEq<FilePath> for SystemPath
Source§impl PartialEq<FilePath> for SystemPathBuf
impl PartialEq<FilePath> for SystemPathBuf
Source§impl PartialEq<FilePath> for VendoredPath
impl PartialEq<FilePath> for VendoredPath
Source§impl PartialEq<FilePath> for VendoredPathBuf
impl PartialEq<FilePath> for VendoredPathBuf
Source§impl PartialEq<SystemPath> for FilePath
impl PartialEq<SystemPath> for FilePath
Source§impl PartialEq<SystemPathBuf> for FilePath
impl PartialEq<SystemPathBuf> for FilePath
Source§impl PartialEq<VendoredPath> for FilePath
impl PartialEq<VendoredPath> for FilePath
Source§impl PartialEq<VendoredPathBuf> for FilePath
impl PartialEq<VendoredPathBuf> for FilePath
impl StructuralPartialEq for FilePath
Auto Trait Implementations§
impl Freeze for FilePath
impl RefUnwindSafe for FilePath
impl Send for FilePath
impl Sync for FilePath
impl Unpin for FilePath
impl UnsafeUnpin for FilePath
impl UnwindSafe for FilePath
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<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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> HashEqLike<&T> for T
impl<T> HashEqLike<&T> for T
Source§impl<T> HashEqLike<Cow<'_, T>> for T
impl<T> HashEqLike<Cow<'_, T>> for T
Source§impl<T> HashEqLike<T> for T
impl<T> HashEqLike<T> for T
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<T> IntoDiagnosticMessage for Twhere
T: Display,
impl<T> IntoDiagnosticMessage for Twhere
T: Display,
fn into_diagnostic_message(self) -> DiagnosticMessage
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 moreSource§impl<T> ToCharString for Twhere
T: Display,
impl<T> ToCharString for Twhere
T: Display,
Source§fn try_to_char_string(&self) -> Result<CharString, ToCharStringError>
fn try_to_char_string(&self) -> Result<CharString, ToCharStringError>
CharString. Read moreSource§fn to_char_string(&self) -> CharString
fn to_char_string(&self) -> CharString
CharString. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more