FileSystemPath

Struct FileSystemPath 

Source
pub struct FileSystemPath {
    pub fs: ResolvedVc<Box<dyn FileSystem>>,
    pub path: RcStr,
}

Fields§

§fs: ResolvedVc<Box<dyn FileSystem>>§path: RcStr

Implementations§

Source§

impl FileSystemPath

Source

pub fn cell(self) -> Vc<Self>

Places a value in a cell of the current task.

Cell is selected based on the value type and call order of cell.

Source

pub fn resolved_cell(self) -> ResolvedVc<Self>

Places a value in a cell of the current task. Returns a [ResolvedVc][turbo_tasks::ResolvedVc].

Cell is selected based on the value type and call order of cell.

Source§

impl FileSystemPath

Source

pub fn value_to_string(&self) -> Vc<RcStr>

Mimics ValueToString::to_string.

Source§

impl FileSystemPath

Source

pub fn is_inside_ref(&self, other: &FileSystemPath) -> bool

Source

pub fn is_inside_or_equal_ref(&self, other: &FileSystemPath) -> bool

Source

pub fn is_root(&self) -> bool

Source

pub fn is_in_node_modules(&self) -> bool

Source

pub fn get_path_to<'a>(&self, inner: &'a FileSystemPath) -> Option<&'a str>

Returns the path of inner relative to self.

Note: this method always strips the leading / from the result.

Source

pub fn get_relative_path_to(&self, other: &FileSystemPath) -> Option<RcStr>

Source

pub fn file_name(&self) -> &str

Returns the final component of the FileSystemPath, or an empty string for the root path.

Source

pub fn has_extension(&self, extension: &str) -> bool

Returns true if this path has the given extension

slightly faster than self.extension_ref() == Some(extension) as we can simply match a suffix

Source

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

Returns the extension (without a leading .)

Source§

impl FileSystemPath

Source

pub fn join(&self, path: &str) -> Result<Self>

Adds a subpath to the current path. The /-separate path argument might contain “..” or “.” segments, but it must not leave the root of the filesystem.

Source

pub fn append(&self, path: &str) -> Result<Self>

Adds a suffix to the filename. [path] must not contain /.

Source

pub fn append_to_stem(&self, appending: &str) -> Result<Self>

Adds a suffix to the basename of the filename. [appending] must not contain /. Extension will stay intact.

Source

pub fn try_join(&self, path: &str) -> Option<FileSystemPath>

Similar to FileSystemPath::join, but returns an Option that will be None when the joined path would leave the filesystem root.

Source

pub fn try_join_inside(&self, path: &str) -> Option<FileSystemPath>

Similar to FileSystemPath::try_join, but returns None when the new path would leave the current path (not just the filesystem root). This is useful for preventing access outside of a directory.

Source

pub fn read_glob(&self, glob: Vc<Glob>) -> Vc<ReadGlobResult>

DETERMINISM: Result is in random order. Either sort result or do not depend on the order.

Source

pub fn track_glob( &self, glob: Vc<Glob>, include_dot_files: bool, ) -> Vc<Completion>

Source

pub fn root(&self) -> Vc<Self>

Source§

impl FileSystemPath

Source

pub fn fs(&self) -> Vc<Box<dyn FileSystem>>

Source

pub fn extension(&self) -> &str

Source

pub fn is_inside(&self, other: &FileSystemPath) -> bool

Source

pub fn is_inside_or_equal(&self, other: &FileSystemPath) -> bool

Source

pub fn with_extension(&self, extension: &str) -> FileSystemPath

Creates a new FileSystemPath like self but with the given extension.

Source

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

Extracts the stem (non-extension) portion of self.file_name.

The stem is:

  • None, if there is no file name;
  • The entire file name if there is no embedded .;
  • The entire file name if the file name begins with . and has no other .s within;
  • Otherwise, the portion of the file name before the final .
Source§

impl FileSystemPath

Source

pub fn read(&self) -> Vc<FileContent>

Source

pub fn read_json(&self) -> Vc<FileJsonContent>

Source

pub fn read_json5(&self) -> Vc<FileJsonContent>

Source

pub fn raw_read_dir(&self) -> Vc<RawDirectoryContent>

Reads content of a directory.

DETERMINISM: Result is in random order. Either sort result or do not depend on the order.

Source

pub fn write(&self, content: Vc<FileContent>) -> Vc<()>

Creates a symbolic link to a directory on *nix platforms, or a directory junction point on Windows.

Windows supports symbolic links, but they can require elevated privileges if “developer mode” is not enabled, so we can’t safely use them. Using junction points matches the behavior of pnpm.

This only supports directories because Windows junction points are incompatible with files. To ensure compatibility, this will return an error if the target is a file, even on platforms with full symlink support.

We intentionally do not provide an API for symlinking a file, as we cannot support that on all Windows configurations.

Source

pub fn metadata(&self) -> Vc<FileMeta>

Source

pub async fn realpath(&self) -> Result<FileSystemPath>

Source

pub fn rebase( fs_path: FileSystemPath, old_base: FileSystemPath, new_base: FileSystemPath, ) -> Vc<FileSystemPath>

Source§

impl FileSystemPath

Source

pub fn read_dir(&self) -> Vc<DirectoryContent>

Reads content of a directory.

DETERMINISM: Result is in random order. Either sort result or do not depend on the order.

Source

pub fn parent(&self) -> FileSystemPath

Source

pub fn get_type(&self) -> Vc<FileSystemEntryType>

Trait Implementations§

Source§

impl<'__de, __Context> BorrowDecode<'__de, __Context> for FileSystemPath

Source§

fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
Source§

impl Clone for FileSystemPath

Source§

fn clone(&self) -> FileSystemPath

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for FileSystemPath

Source§

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

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

impl<__Context> Decode<__Context> for FileSystemPath

Source§

fn decode<__D: Decoder<Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
Source§

impl Display for FileSystemPath

Source§

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

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

impl Encode for FileSystemPath

Source§

fn encode<__E: Encoder>(&self, encoder: &mut __E) -> Result<(), EncodeError>

Encode a given type.
Source§

impl Hash for FileSystemPath

Source§

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

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

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FileSystemPath

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ShrinkToFit for FileSystemPath

Source§

fn shrink_to_fit(&mut self)

Source§

impl TaskInput for FileSystemPath

Source§

fn is_resolved(&self) -> bool

Source§

fn is_transient(&self) -> bool

Source§

fn resolve_input(&self) -> impl Future<Output = Result<Self>> + Send + '_

Source§

impl TraceRawVcs for FileSystemPath

Source§

fn trace_raw_vcs(&self, __context__: &mut TraceRawVcsContext)

§

fn get_raw_vcs(&self) -> Vec<RawVc>

Source§

impl ValueDebug for FileSystemPath

Source§

fn dbg(self: Vc<Self>) -> Vc<ValueDebugString>

Source§

fn dbg_depth(self: Vc<Self>, depth: usize) -> Vc<ValueDebugString>

Like dbg, but with a depth limit.
Source§

impl ValueDebugFormat for FileSystemPath

Source§

fn value_debug_format<'a>(&'a self, depth: usize) -> ValueDebugFormatString<'a>

Source§

impl ValueToString for FileSystemPath

Source§

fn to_string(self: Vc<Self>) -> Vc<RcStr>

Source§

impl VcValueType for FileSystemPath

Source§

type Read = VcDefaultRead<FileSystemPath>

How to read the value.
Source§

type CellMode = VcCellCompareMode<FileSystemPath>

How to update cells of this value type.
Source§

fn get_value_type_id() -> ValueTypeId

Returns the type id of the value type.
Source§

fn has_serialization() -> bool

Source§

impl Eq for FileSystemPath

Source§

impl NonLocalValue for FileSystemPath

Source§

impl StructuralPartialEq for FileSystemPath

Source§

impl Upcast<Box<dyn ValueDebug>> for FileSystemPath

Source§

impl Upcast<Box<dyn ValueToString>> for FileSystemPath

Source§

impl UpcastStrict<Box<dyn ValueDebug>> for FileSystemPath

Source§

impl UpcastStrict<Box<dyn ValueToString>> for FileSystemPath

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
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> DynHash for T
where T: Any + Hash,

§

fn dyn_hash(&self, state: &mut dyn Hasher)

§

impl<T> DynPartialEq for T
where T: Any + PartialEq,

§

fn dyn_partial_eq(&self, other: &(dyn Any + 'static)) -> bool

§

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

§

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

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

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

§

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T> MagicAny for T
where T: Debug + Eq + Hash + Send + Sync + TraceRawVcs + 'static,

§

fn magic_type_name(&self) -> &'static str

§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> DynEq for T
where T: Any + Eq,