pub struct CVarLoaderPluginBuilder { /* private fields */ }Expand description
A builder to create a new CVarLoaderPlugin
Implementations§
Source§impl CVarLoaderPluginBuilder
impl CVarLoaderPluginBuilder
Sourcepub fn fancy() -> Self
pub fn fancy() -> Self
The fancy default, loading layers from the asset path ConfigLayers/ and automatically loading the default layers.
Does not set the user config file path or add any extra layers.
Sourcepub fn load_default_layers(self) -> Self
pub fn load_default_layers(self) -> Self
Adds the default layers to the load list. The following layers are ‘default’ and may be added depending on build configuration:
debug_assertions.tomlforcfg(debug_assertions)
Sourcepub fn add_asset_layer_if(self, given: bool, layer: &'static str) -> Self
pub fn add_asset_layer_if(self, given: bool, layer: &'static str) -> Self
Conditionally adds an asset layer, meant to be used with cfg! or other conditions.
You should prefer actual rust if statements for anything complex.
let builder =
CVarLoaderPluginBuilder::fancy()
.add_asset_layer_if(cfg!(feature = "dev_tools"), "dev_tools.toml")
.add_asset_layer_if(cfg!(feature = "release"), "release.toml");
Sourcepub fn add_asset_layer(self, layer: &'static str) -> Self
pub fn add_asset_layer(self, layer: &'static str) -> Self
Adds an asset layer to the builder.
Sourcepub fn with_layers_root(self, path: AssetPath<'static>) -> Self
pub fn with_layers_root(self, path: AssetPath<'static>) -> Self
Sets the root for config layers.
Sourcepub fn with_user_config_file(self, path: PathBuf) -> Self
pub fn with_user_config_file(self, path: PathBuf) -> Self
Sets the user config file location.
Sourcepub fn with_asset_layer(self, path: PathBuf) -> Self
pub fn with_asset_layer(self, path: PathBuf) -> Self
Adds a layer to load from the layer root. This should be a file relative to the root.
Sourcepub fn add_layer(self, layer: DocumentContext<String>) -> Self
pub fn add_layer(self, layer: DocumentContext<String>) -> Self
Adds a pre-parsed config layer to apply.
Sourcepub fn build(self) -> CVarLoaderPlugin
pub fn build(self) -> CVarLoaderPlugin
Consumes the builder to create a CVarLoaderPlugin.
Trait Implementations§
Source§impl Default for CVarLoaderPluginBuilder
impl Default for CVarLoaderPluginBuilder
Source§fn default() -> CVarLoaderPluginBuilder
fn default() -> CVarLoaderPluginBuilder
Auto Trait Implementations§
impl Freeze for CVarLoaderPluginBuilder
impl RefUnwindSafe for CVarLoaderPluginBuilder
impl Send for CVarLoaderPluginBuilder
impl Sync for CVarLoaderPluginBuilder
impl Unpin for CVarLoaderPluginBuilder
impl UnsafeUnpin for CVarLoaderPluginBuilder
impl UnwindSafe for CVarLoaderPluginBuilder
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> 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> 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().
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> 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 more