Skip to main content

RealFs

Struct RealFs 

Source
pub struct RealFs { /* private fields */ }
Expand description

Real-filesystem SourceTree: walks a root directory and enumerates .brink keys, keyed by root-relative path. Enumeration goes through the shared brink_source_tree::Walk, so it never descends into brink_source_tree::IGNORED_DIR_NAMES (target/, .git/, node_modules/ — issue #1381 hand-rolled that prune here; issue #1433 moved the enforcement into the walk itself, where it can’t be forgotten), so a stray build-output or dependency tree under root is never enumerated. read serves any key lazily off disk — it never eagerly reads the tree, so one malformed/unreadable file elsewhere under root cannot fail a read of an unrelated key (issue #1357).

list also reads root’s own brink.toml (if any) for [project] unprune-dirs, issue #1407’s escape hatch for a project that legitimately keeps .brink sources under one of those pruned names — see [unprune_dirs] — and, when a pruned directory shallowly contains a .brink file that unprune-dirs didn’t name, logs a tracing::warn! naming it (#1407’s silent-skip diagnostic) rather than saying nothing. Neither behavior changes what a clean tree with no config or no pruned sources enumerates.

list’s .brink-only scope is fixed — there used to be a second, .brink + .ink scope reachable via a RealFs::project constructor (issue #1357’s CLI producer mount), but every caller of that wider scope either filtered list()’s output back down to .brink itself (brink-environment’s collect_sources, for a native entry) or never called list() at all (the same function’s ink-entry branch, which reads through the tree via INCLUDE BFS instead). The extra .ink keys were therefore never observable through any real call path, so issue #1404 deleted the second scope and collapsed RealFs::project’s callers onto this single .brink-only constructor.

Both list and read resolve against the root this instance was constructed with — neither takes a root parameter (issue #1371: SourceTree::list used to take one, but RealFs always ignored it in favor of its own constructor-held root, while GitRev’s pre-#1371 list used the passed-in root instead of its own constructor-held one — two impls silently disagreeing on which root governed the same call. Dropping the parameter everywhere makes “root is constructor-held” the only contract left to honor).

Implementations§

Source§

impl RealFs

Source

pub fn new(root: impl Into<PathBuf>) -> Self

Construct a RealFs seam rooted at root, listing .brink keys only. read resolves keys (as returned by list) relative to this root.

Trait Implementations§

Source§

impl Clone for RealFs

Source§

fn clone(&self) -> RealFs

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 RealFs

Source§

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

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

impl SourceTree for RealFs

Source§

fn list(&self) -> Result<Vec<String>>

Enumerate every source key under the implementation’s own root, sorted deterministically by key.
Source§

fn read(&self, key: &str) -> Result<String>

Read the source text for key. Read more

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> Lookup<T> for T

Source§

fn into_owned(self) -> T

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, 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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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