pub struct InkLoader {
pub override_config: Option<ProjectConfig>,
}Expand description
Asset loader for .ink (source) files.
Reads the entry source, walks the INCLUDE graph asynchronously
through Bevy’s AssetReader, lands the drained sources in a
brink_source_tree::InMemory tree, then goes through the
brink_environment producer: Project::load resolves brink.toml
and override precedence and freezes an Environment, and
brink_environment::compile compiles it. Links the result via
brink_runtime::link and emits labeled subassets (#program,
#line_tables) just like InkbLoader.
§brink.toml discovery (#1029, #1360, #1406, #1439)
A brink.toml beside (or above) the entry asset supplies the
ProjectConfig (dialect/types) that gates T1b brink-extension
syntax — the same file the CLI discovers by walking the real
filesystem (brink-project-config::load_from_entry). Bevy’s
AssetReader may be virtual or packed, so load
probes for it over the async reader itself: brink.toml beside the
entry, then each ancestor directory in turn (nearest first), via
LoadContext::read_asset_bytes — bounded at the asset source root
(never above it) and naturally finite (the entry path has finitely many
/-separated ancestors). As of #1439, [probe_brink_toml] stops at the
first candidate it finds — the nearest one, since the walk is
nearest-first — so only that candidate is ever read or registered as a
load dependency; a farther, shadowed brink.toml is never fetched, so
editing one in dev mode no longer triggers a hot-reload. The candidate’s
text is landed at its own key in the drained source map; parsing it and
applying CLI/API > file > default precedence is Project::load’s job
(brink_project_config::discover_from_entry_in_tree over the same map,
walking the same bounded ancestor chain again over whatever the map
contains) — this loader only supplies candidate bytes, it does not
re-implement the resolution policy. Because the probe already stops at
the nearest hit, Project::load’s walk finds at most one candidate in
practice, but it is still the one place that applies the precedence
rule; the probe is, deliberately, back to being a second “which
candidate is nearest” decider (the duplication #1406 removed and #1439
reintroduced on purpose, for the perf win — see [probe_brink_toml]’s
doc). The two decisions agree by construction today because both walk
[ancestor_dirs]-equivalent nearest-first order over the same bounded
chain, but they are two independent implementations: a future change to
brink-project-config’s bound/precedence shape would need to be mirrored
here to stay honored on this path. A miss at every level leaves
AnalysisOptions at its default — byte-identical to pre-#1029 behavior.
override_config, set via
BrinkPlugin::with_config /
BrinkAssetsPlugin::with_config,
is the programmatic escape hatch: when set, its fields win over
whatever brink.toml supplies — passed through as
OptionOverrides, the same explicit call always wins over the file
precedence Project::load applies for every mount (CLI included).
Fields§
§override_config: Option<ProjectConfig>Out-of-band ProjectConfig override (#1029). None (the
default) means “the discovered brink.toml asset (if any) wins”;
Some fields win over the asset’s, unset fields still fall
through to whatever the asset (or the built-in default) supplies.
Trait Implementations§
Source§impl AssetLoader for InkLoader
impl AssetLoader for InkLoader
Source§type Asset = BrinkStoryAsset
type Asset = BrinkStoryAsset
Asset loaded by this AssetLoader.Source§type Settings = ()
type Settings = ()
AssetLoader.Source§type Error = InkLoaderError
type Error = InkLoaderError
Source§async fn load(
&self,
reader: &mut dyn Reader,
_settings: &Self::Settings,
load_context: &mut LoadContext<'_>,
) -> Result<Self::Asset, Self::Error>
async fn load( &self, reader: &mut dyn Reader, _settings: &Self::Settings, load_context: &mut LoadContext<'_>, ) -> Result<Self::Asset, Self::Error>
AssetLoader::Asset (and any other labeled assets) from the bytes provided by Reader.Source§fn extensions(&self) -> &[&str]
fn extensions(&self) -> &[&str]
AssetLoader, without the preceding dot.
Note that users of this AssetLoader may choose to load files with a non-matching extension.Source§impl TypePath for InkLoader
impl TypePath for InkLoader
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
Auto Trait Implementations§
impl Freeze for InkLoader
impl RefUnwindSafe for InkLoader
impl Send for InkLoader
impl Sync for InkLoader
impl Unpin for InkLoader
impl UnsafeUnpin for InkLoader
impl UnwindSafe for InkLoader
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
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
Source§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path.Source§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
Source§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident.Source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name.Source§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
Source§impl<L> ErasedAssetLoader for L
impl<L> ErasedAssetLoader for L
Source§fn load<'a>(
&'a self,
reader: &'a mut dyn Reader,
settings: &'a (dyn Settings + 'static),
load_context: LoadContext<'a>,
) -> Pin<Box<dyn ConditionalSendFuture<Output = Result<ErasedLoadedAsset, BevyError>> + 'a>>
fn load<'a>( &'a self, reader: &'a mut dyn Reader, settings: &'a (dyn Settings + 'static), load_context: LoadContext<'a>, ) -> Pin<Box<dyn ConditionalSendFuture<Output = Result<ErasedLoadedAsset, BevyError>> + 'a>>
Processes the asset in an asynchronous closure.
Source§fn extensions(&self) -> &[&str]
fn extensions(&self) -> &[&str]
Source§fn deserialize_meta(
&self,
meta: &[u8],
) -> Result<Box<dyn AssetMetaDyn>, DeserializeMetaError>
fn deserialize_meta( &self, meta: &[u8], ) -> Result<Box<dyn AssetMetaDyn>, DeserializeMetaError>
meta bytes into the appropriate type (erased as Box<dyn AssetMetaDyn>).Source§fn default_meta(&self) -> Box<dyn AssetMetaDyn>
fn default_meta(&self) -> Box<dyn AssetMetaDyn>
AssetLoader (erased as Box<dyn AssetMetaDyn>).Source§fn type_path(&self) -> &'static str
fn type_path(&self) -> &'static str
AssetLoader.Source§fn asset_type_name(&self) -> &'static str
fn asset_type_name(&self) -> &'static str
Asset loaded by the AssetLoader.Source§fn asset_type_id(&self) -> TypeId
fn asset_type_id(&self) -> TypeId
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().