Skip to main content

Project

Struct Project 

Source
pub struct Project;
Expand description

The producer namespace: Project::load turns a mount (a SourceTree) into an Environment.

Project is where every ambient/effectful concern lives (filesystem walks, an AssetReader drain, an LSP store, and — later — dependency resolution), quarantined off the pure Environment it produces.

Implementations§

Source§

impl Project

Source

pub fn load( tree: &dyn SourceTree, entry: &str, overrides: &OptionOverrides, ) -> Result<Environment, LoadError>

Walk tree, read + hash its sources, discover + parse brink.toml over the same tree, apply override precedence, and freeze an Environment.

The tree is treated as rooted at . with root-relative keys (the #1312 SourceTree config-discovery convention): entry is a root-relative key, and any brink.toml is looked up by a direct {ancestor}/brink.toml probe walking up from entry (#1370 — discovery no longer calls list at all, so a mount’s list is not required to surface brink.toml). The mount is responsible for rooting its tree (the CLI drains its project root into an in-memory tree; web / LSP push their own root-relative store).

Sync — the only asynchrony a mount has (e.g. a bevy AssetReader) is quarantined in building the tree, before this runs, matching the InkLoader drain-then-compile pattern.

Dispatches on entry’s extension: a .brink entry’s universe is the whole native source tree (enumerate every .brink key); a .ink entry follows its INCLUDE graph from the entry (a BFS over the tree’s reads).

§Repeat compiles are deterministic

Each call resolves AnalysisOptions from a brand-new AnalysisOptions::default() (see resolve_options below) — never one left over from a previous call — so two sequential load calls for unrelated projects never leak dialect/types between them, even though AnalysisOptions::apply_project_config’s “unset means untouched” rule for those two fields would otherwise let a stale value silently survive (see that method’s own “must be fresh” invariant doc). This matters for any caller that calls load repeatedly against different mounts in the same process — notably bevy-brink’s InkLoader, invoked once per .ink asset (re)load — where a leaked dialect would make the n-th load’s outcome depend on what the (n-1)-th load happened to resolve. Pinned by repeat_compiles_do_not_leak_options_across_project_load_calls below.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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