pub struct RanimApp(App);Expand description
A project with plugin construction finalized.
Produced by RanimAppExt::build, which runs bevy’s plugin finish and
cleanup exactly once. CLI and canvas/interactive preview hosts consume
this project and may install render sub-apps into it. Offline render workers
instead receive a selected Scene and its rendering configuration.
This wrapper is no longer a plugin-construction target.
Tuple Fields§
§0: AppImplementations§
Methods from Deref<Target = App>§
pub fn update(&mut self)
pub fn update(&mut self)
Runs the default schedules of all sub-apps (starting with the “main” app) once.
pub fn run(&mut self) -> AppExit
pub fn run(&mut self) -> AppExit
Runs the App by calling its runner.
This will (re)build the App first. For general usage, see the example on the item
level documentation.
§Caveats
Calls to App::run() will never return on iOS and Web.
Headless apps can generally expect this method to return control to the caller when it completes, but that is not the case for windowed apps. Windowed apps are typically driven by an event loop and some platforms expect the program to terminate when the event loop ends.
By default, Bevy uses the winit crate for window creation.
§Panics
Panics if not all plugins have been built.
pub fn set_runner(
&mut self,
f: impl FnOnce(App) -> AppExit + 'static,
) -> &mut App
pub fn set_runner( &mut self, f: impl FnOnce(App) -> AppExit + 'static, ) -> &mut App
Sets the function that will be called when the app is run.
The runner function f is called only once by App::run. If the
presence of a main loop in the app is desired, it is the responsibility of the runner
function to provide it.
The runner function is usually not set manually, but by Bevy integrated plugins
(e.g. WinitPlugin).
§Examples
fn my_runner(mut app: App) -> AppExit {
loop {
println!("In main loop");
app.update();
if let Some(exit) = app.should_exit() {
return exit;
}
}
}
App::new()
.set_runner(my_runner);pub fn plugins_state(&mut self) -> PluginsState
pub fn plugins_state(&mut self) -> PluginsState
Returns the state of all plugins. This is usually called by the event loop, but can be
useful for situations where you want to use App::update.
pub fn finish(&mut self)
pub fn finish(&mut self)
Runs Plugin::finish for each plugin. This is usually called by the event loop once all
plugins are ready, but can be useful for situations where you want to use App::update.
pub fn cleanup(&mut self)
pub fn cleanup(&mut self)
Runs Plugin::cleanup for each plugin. This is usually called by the event loop after
App::finish, but can be useful for situations where you want to use App::update.
pub fn add_systems<M>(
&mut self,
schedule: impl ScheduleLabel,
systems: impl IntoScheduleConfigs<Box<dyn System<Out = (), In = ()>>, M>,
) -> &mut App
pub fn add_systems<M>( &mut self, schedule: impl ScheduleLabel, systems: impl IntoScheduleConfigs<Box<dyn System<Out = (), In = ()>>, M>, ) -> &mut App
Adds one or more systems to the given schedule in this app’s [Schedules].
§Examples
app.add_systems(Update, (system_a, system_b, system_c));
app.add_systems(Update, (system_a, system_b).run_if(should_run));pub fn remove_systems_in_set<M>(
&mut self,
schedule: impl ScheduleLabel,
set: impl IntoSystemSet<M>,
policy: ScheduleCleanupPolicy,
) -> Result<usize, ScheduleError>
pub fn remove_systems_in_set<M>( &mut self, schedule: impl ScheduleLabel, set: impl IntoSystemSet<M>, policy: ScheduleCleanupPolicy, ) -> Result<usize, ScheduleError>
Removes all systems in a [SystemSet]. This will cause the schedule to be rebuilt when
the schedule is run again and can be slow. A [ScheduleError] is returned if the schedule needs to be
[Schedule::initialize]’d or the set is not found.
Note that this can remove all systems of a type if you pass the system to this function as systems implicitly create a set based on the system type.
§Example
// add the system
app.add_systems(Update, system_a);
// remove the system
app.remove_systems_in_set(Update, system_a, ScheduleCleanupPolicy::RemoveSystemsOnly);pub fn register_system<I, O, M>(
&mut self,
system: impl IntoSystem<I, O, M> + 'static,
) -> SystemId<I, O>where
I: SystemInput + 'static,
O: 'static,
pub fn register_system<I, O, M>(
&mut self,
system: impl IntoSystem<I, O, M> + 'static,
) -> SystemId<I, O>where
I: SystemInput + 'static,
O: 'static,
Registers a system and returns a [SystemId] so it can later be called by [World::run_system].
It’s possible to register the same systems more than once, they’ll be stored separately.
This is different from adding systems to a [Schedule] with App::add_systems,
because the [SystemId] that is returned can be used anywhere in the [World] to run the associated system.
This allows for running systems in a push-based fashion.
Using a [Schedule] is still preferred for most cases
due to its better performance and ability to run non-conflicting systems simultaneously.
pub fn register_tracked_system<I, O, M>(
&mut self,
system: impl IntoSystem<I, O, M> + 'static,
) -> SystemHandle<I, O>where
I: SystemInput + 'static,
O: 'static,
pub fn register_tracked_system<I, O, M>(
&mut self,
system: impl IntoSystem<I, O, M> + 'static,
) -> SystemHandle<I, O>where
I: SystemInput + 'static,
O: 'static,
Registers a system and returns a tracked SystemHandle so it can later
be called by [World::run_system]. The system entity will be automatically
queued for despawn when the last clone of the returned handle is dropped.
See [World::register_tracked_system] for more details.
pub fn configure_sets<M>(
&mut self,
schedule: impl ScheduleLabel,
sets: impl IntoScheduleConfigs<Interned<dyn SystemSet>, M>,
) -> &mut App
pub fn configure_sets<M>( &mut self, schedule: impl ScheduleLabel, sets: impl IntoScheduleConfigs<Interned<dyn SystemSet>, M>, ) -> &mut App
Configures a collection of system sets in the provided schedule, adding any sets that do not exist.
pub fn add_message<M>(&mut self) -> &mut Appwhere
M: Message,
pub fn add_message<M>(&mut self) -> &mut Appwhere
M: Message,
Initializes [Message] handling for T by inserting a message queue resource ([Messages::<T>]).
See [Messages] for information on how to define messages.
§Examples
app.add_message::<MyMessage>();pub fn insert_resource<R>(&mut self, resource: R) -> &mut Appwhere
R: Resource,
pub fn insert_resource<R>(&mut self, resource: R) -> &mut Appwhere
R: Resource,
Inserts the Resource into the app, overwriting any existing resource of the same type.
There is also an init_resource for resources that have
Default or [FromWorld] implementations.
§Examples
#[derive(Resource)]
struct MyCounter {
counter: usize,
}
App::new()
.insert_resource(MyCounter { counter: 0 });pub fn init_resource<R>(&mut self) -> &mut Appwhere
R: Resource + FromWorld,
pub fn init_resource<R>(&mut self) -> &mut Appwhere
R: Resource + FromWorld,
Inserts the Resource, initialized with its default value, into the app,
if there is no existing instance of R.
R must implement [FromWorld].
If R implements Default, [FromWorld] will be automatically implemented and
initialize the Resource with Default::default.
§Examples
#[derive(Resource)]
struct MyCounter {
counter: usize,
}
impl Default for MyCounter {
fn default() -> MyCounter {
MyCounter {
counter: 100
}
}
}
App::new()
.init_resource::<MyCounter>();pub fn insert_non_send<R>(&mut self, resource: R) -> &mut Appwhere
R: 'static,
pub fn insert_non_send<R>(&mut self, resource: R) -> &mut Appwhere
R: 'static,
Inserts the !Send data into the app, overwriting any existing data
of the same type.
There is also an init_non_send for !Send data
that implement Default
§Examples
struct MyCounter {
counter: usize,
}
App::new()
.insert_non_send(MyCounter { counter: 0 });pub fn init_non_send<R>(&mut self) -> &mut Appwhere
R: 'static + FromWorld,
pub fn init_non_send<R>(&mut self) -> &mut Appwhere
R: 'static + FromWorld,
Inserts the !Send data into the app if there is no existing instance of R.
R must implement [FromWorld].
If R implements Default, [FromWorld] will be automatically implemented and
initialize the Resource with Default::default.
pub fn is_plugin_added<T>(&self) -> boolwhere
T: Plugin,
pub fn is_plugin_added<T>(&self) -> boolwhere
T: Plugin,
Returns true if the Plugin has already been added.
pub fn get_added_plugins<T>(&self) -> Vec<&T>where
T: Plugin,
pub fn get_added_plugins<T>(&self) -> Vec<&T>where
T: Plugin,
Returns a vector of references to all plugins of type T that have been added.
This can be used to read the settings of any existing plugins.
This vector will be empty if no plugins of that type have been added.
If multiple copies of the same plugin are added to the App, they will be listed in insertion order in this vector.
let default_sampler = app.get_added_plugins::<ImagePlugin>()[0].default_sampler;pub fn add_plugins<M>(&mut self, plugins: impl Plugins<M>) -> &mut App
pub fn add_plugins<M>(&mut self, plugins: impl Plugins<M>) -> &mut App
Installs a Plugin collection.
Bevy prioritizes modularity as a core principle. All engine features are implemented as plugins, even the complex ones like rendering.
Plugins can be grouped into a set by using a PluginGroup.
There are built-in PluginGroups that provide core engine functionality.
The PluginGroups available by default are DefaultPlugins and MinimalPlugins.
To customize the plugins in the group (reorder, disable a plugin, add a new plugin
before / after another plugin), call build() on the group,
which will convert it to a PluginGroupBuilder.
You can also specify a group of Plugins by using a tuple over Plugins and
PluginGroups. See [Plugins] for more details.
§Examples
App::new()
.add_plugins(MinimalPlugins);
App::new()
.add_plugins((MinimalPlugins, LogPlugin));§Panics
Panics if one of the plugins had already been added to the application.
pub fn register_required_components<T, R>(&mut self) -> &mut Appwhere
T: Component,
R: Component + Default,
pub fn register_required_components<T, R>(&mut self) -> &mut Appwhere
T: Component,
R: Component + Default,
Registers the given component R as a required component for T.
When T is added to an entity, R and its own required components will also be added
if R was not already provided. The Default constructor will be used for the creation of R.
If a custom constructor is desired, use App::register_required_components_with instead.
For the non-panicking version, see App::try_register_required_components.
Note that requirements must currently be registered before T is inserted into the world
for the first time. Commonly, this is done in plugins. This limitation may be fixed in the future.
§Panics
Panics if R is already a directly required component for T, or if T has ever been added
on an entity before the registration.
Indirect requirements through other components are allowed. In those cases, any existing requirements will only be overwritten if the new requirement is more specific.
§Example
#[derive(Component)]
struct A;
#[derive(Component, Default, PartialEq, Eq, Debug)]
struct B(usize);
#[derive(Component, Default, PartialEq, Eq, Debug)]
struct C(u32);
// Register B as required by A and C as required by B.
app.register_required_components::<A, B>();
app.register_required_components::<B, C>();
fn setup(mut commands: Commands) {
// This will implicitly also insert B and C with their Default constructors.
commands.spawn(A);
}
fn validate(query: Option<Single<(&A, &B, &C)>>) {
let (a, b, c) = query.unwrap().into_inner();
assert_eq!(b, &B(0));
assert_eq!(c, &C(0));
}pub fn register_required_components_with<T, R>(
&mut self,
constructor: impl Fn() -> R + 'static,
) -> &mut Appwhere
T: Component,
R: Component,
pub fn register_required_components_with<T, R>(
&mut self,
constructor: impl Fn() -> R + 'static,
) -> &mut Appwhere
T: Component,
R: Component,
Registers the given component R as a required component for T.
When T is added to an entity, R and its own required components will also be added
if R was not already provided. The given constructor will be used for the creation of R.
If a Default constructor is desired, use App::register_required_components instead.
For the non-panicking version, see App::try_register_required_components_with.
Note that requirements must currently be registered before T is inserted into the world
for the first time. Commonly, this is done in plugins. This limitation may be fixed in the future.
§Panics
Panics if R is already a directly required component for T, or if T has ever been added
on an entity before the registration.
Indirect requirements through other components are allowed. In those cases, any existing requirements will only be overwritten if the new requirement is more specific.
§Example
#[derive(Component)]
struct A;
#[derive(Component, Default, PartialEq, Eq, Debug)]
struct B(usize);
#[derive(Component, Default, PartialEq, Eq, Debug)]
struct C(u32);
// Register B and C as required by A and C as required by B.
// A requiring C directly will overwrite the indirect requirement through B.
app.register_required_components::<A, B>();
app.register_required_components_with::<B, C>(|| C(1));
app.register_required_components_with::<A, C>(|| C(2));
fn setup(mut commands: Commands) {
// This will implicitly also insert B with its Default constructor and C
// with the custom constructor defined by A.
commands.spawn(A);
}
fn validate(query: Option<Single<(&A, &B, &C)>>) {
let (a, b, c) = query.unwrap().into_inner();
assert_eq!(b, &B(0));
assert_eq!(c, &C(2));
}pub fn try_register_required_components<T, R>(
&mut self,
) -> Result<(), RequiredComponentsError>where
T: Component,
R: Component + Default,
pub fn try_register_required_components<T, R>(
&mut self,
) -> Result<(), RequiredComponentsError>where
T: Component,
R: Component + Default,
Tries to register the given component R as a required component for T.
When T is added to an entity, R and its own required components will also be added
if R was not already provided. The Default constructor will be used for the creation of R.
If a custom constructor is desired, use App::register_required_components_with instead.
For the panicking version, see App::register_required_components.
Note that requirements must currently be registered before T is inserted into the world
for the first time. Commonly, this is done in plugins. This limitation may be fixed in the future.
§Errors
Returns a [RequiredComponentsError] if R is already a directly required component for T, or if T has ever been added
on an entity before the registration.
Indirect requirements through other components are allowed. In those cases, any existing requirements will only be overwritten if the new requirement is more specific.
§Example
#[derive(Component)]
struct A;
#[derive(Component, Default, PartialEq, Eq, Debug)]
struct B(usize);
#[derive(Component, Default, PartialEq, Eq, Debug)]
struct C(u32);
// Register B as required by A and C as required by B.
app.register_required_components::<A, B>();
app.register_required_components::<B, C>();
// Duplicate registration! This will fail.
assert!(app.try_register_required_components::<A, B>().is_err());
fn setup(mut commands: Commands) {
// This will implicitly also insert B and C with their Default constructors.
commands.spawn(A);
}
fn validate(query: Option<Single<(&A, &B, &C)>>) {
let (a, b, c) = query.unwrap().into_inner();
assert_eq!(b, &B(0));
assert_eq!(c, &C(0));
}pub fn try_register_required_components_with<T, R>(
&mut self,
constructor: impl Fn() -> R + 'static,
) -> Result<(), RequiredComponentsError>where
T: Component,
R: Component,
pub fn try_register_required_components_with<T, R>(
&mut self,
constructor: impl Fn() -> R + 'static,
) -> Result<(), RequiredComponentsError>where
T: Component,
R: Component,
Tries to register the given component R as a required component for T.
When T is added to an entity, R and its own required components will also be added
if R was not already provided. The given constructor will be used for the creation of R.
If a Default constructor is desired, use App::register_required_components instead.
For the panicking version, see App::register_required_components_with.
Note that requirements must currently be registered before T is inserted into the world
for the first time. Commonly, this is done in plugins. This limitation may be fixed in the future.
§Errors
Returns a [RequiredComponentsError] if R is already a directly required component for T, or if T has ever been added
on an entity before the registration.
Indirect requirements through other components are allowed. In those cases, any existing requirements will only be overwritten if the new requirement is more specific.
§Example
#[derive(Component)]
struct A;
#[derive(Component, Default, PartialEq, Eq, Debug)]
struct B(usize);
#[derive(Component, Default, PartialEq, Eq, Debug)]
struct C(u32);
// Register B and C as required by A and C as required by B.
// A requiring C directly will overwrite the indirect requirement through B.
app.register_required_components::<A, B>();
app.register_required_components_with::<B, C>(|| C(1));
app.register_required_components_with::<A, C>(|| C(2));
// Duplicate registration! Even if the constructors were different, this would fail.
assert!(app.try_register_required_components_with::<B, C>(|| C(1)).is_err());
fn setup(mut commands: Commands) {
// This will implicitly also insert B with its Default constructor and C
// with the custom constructor defined by A.
commands.spawn(A);
}
fn validate(query: Option<Single<(&A, &B, &C)>>) {
let (a, b, c) = query.unwrap().into_inner();
assert_eq!(b, &B(0));
assert_eq!(c, &C(2));
}pub fn register_disabling_component<C>(&mut self)where
C: Component,
pub fn register_disabling_component<C>(&mut self)where
C: Component,
Registers a component type as “disabling”, using default query filters to exclude entities with the component from queries.
§Warning
As discussed in the module docs, this can have performance implications, as well as create interoperability issues, and should be used with caution.
pub fn world(&self) -> &World
pub fn world(&self) -> &World
Returns a reference to the main [SubApp]’s [World]. This is the same as calling
app.main().world().
pub fn world_mut(&mut self) -> &mut World
pub fn world_mut(&mut self) -> &mut World
Returns a mutable reference to the main [SubApp]’s [World]. This is the same as calling
app.main_mut().world_mut().
pub fn main(&self) -> &SubApp
pub fn main(&self) -> &SubApp
Returns a reference to the main [SubApp].
pub fn main_mut(&mut self) -> &mut SubApp
pub fn main_mut(&mut self) -> &mut SubApp
Returns a mutable reference to the main [SubApp].
pub fn sub_apps(&self) -> &SubApps
pub fn sub_apps(&self) -> &SubApps
Returns a reference to the [SubApps] collection.
pub fn sub_apps_mut(&mut self) -> &mut SubApps
pub fn sub_apps_mut(&mut self) -> &mut SubApps
Returns a mutable reference to the [SubApps] collection.
pub fn sub_app(&self, label: impl AppLabel) -> &SubApp
pub fn sub_app(&self, label: impl AppLabel) -> &SubApp
Returns a reference to the [SubApp] with the given label.
§Panics
Panics if the [SubApp] doesn’t exist.
pub fn sub_app_mut(&mut self, label: impl AppLabel) -> &mut SubApp
pub fn sub_app_mut(&mut self, label: impl AppLabel) -> &mut SubApp
Returns a reference to the [SubApp] with the given label.
§Panics
Panics if the [SubApp] doesn’t exist.
pub fn get_sub_app(&self, label: impl AppLabel) -> Option<&SubApp>
pub fn get_sub_app(&self, label: impl AppLabel) -> Option<&SubApp>
Returns a reference to the [SubApp] with the given label, if it exists.
pub fn get_sub_app_mut(&mut self, label: impl AppLabel) -> Option<&mut SubApp>
pub fn get_sub_app_mut(&mut self, label: impl AppLabel) -> Option<&mut SubApp>
Returns a mutable reference to the [SubApp] with the given label, if it exists.
pub fn insert_sub_app(&mut self, label: impl AppLabel, sub_app: SubApp)
pub fn insert_sub_app(&mut self, label: impl AppLabel, sub_app: SubApp)
Inserts a [SubApp] with the given label.
pub fn remove_sub_app(&mut self, label: impl AppLabel) -> Option<SubApp>
pub fn remove_sub_app(&mut self, label: impl AppLabel) -> Option<SubApp>
Removes the [SubApp] with the given label, if it exists.
pub fn update_sub_app_by_label(&mut self, label: impl AppLabel)
pub fn update_sub_app_by_label(&mut self, label: impl AppLabel)
Extract data from the main world into the [SubApp] with the given label and perform an update if it exists.
pub fn add_schedule(&mut self, schedule: Schedule) -> &mut App
pub fn add_schedule(&mut self, schedule: Schedule) -> &mut App
Inserts a new schedule under the provided label, overwriting any existing
schedule with the same label.
pub fn init_schedule(&mut self, label: impl ScheduleLabel) -> &mut App
pub fn init_schedule(&mut self, label: impl ScheduleLabel) -> &mut App
Initializes an empty schedule under the provided label, if it does not exist.
See add_schedule to insert an existing schedule.
pub fn get_schedule(&self, label: impl ScheduleLabel) -> Option<&Schedule>
pub fn get_schedule(&self, label: impl ScheduleLabel) -> Option<&Schedule>
Returns a reference to the [Schedule] with the provided label if it exists.
pub fn get_schedule_mut(
&mut self,
label: impl ScheduleLabel,
) -> Option<&mut Schedule>
pub fn get_schedule_mut( &mut self, label: impl ScheduleLabel, ) -> Option<&mut Schedule>
Returns a mutable reference to the [Schedule] with the provided label if it exists.
pub fn edit_schedule(
&mut self,
label: impl ScheduleLabel,
f: impl FnMut(&mut Schedule),
) -> &mut App
pub fn edit_schedule( &mut self, label: impl ScheduleLabel, f: impl FnMut(&mut Schedule), ) -> &mut App
Runs function f with the [Schedule] associated with label.
Note: This will create the schedule if it does not already exist.
pub fn configure_schedules(
&mut self,
schedule_build_settings: ScheduleBuildSettings,
) -> &mut App
pub fn configure_schedules( &mut self, schedule_build_settings: ScheduleBuildSettings, ) -> &mut App
Applies the provided [ScheduleBuildSettings] to all schedules.
This mutates all currently present schedules, but does not apply to any custom schedules that might be added in the future.
pub fn allow_ambiguous_component<T>(&mut self) -> &mut Appwhere
T: Component,
pub fn allow_ambiguous_component<T>(&mut self) -> &mut Appwhere
T: Component,
When doing ambiguity checking this
ignores systems that are ambiguous on [Component] T.
This settings only applies to the main world. To apply this to other worlds call the corresponding method on World
§Example
#[derive(Component)]
struct A;
// these systems are ambiguous on A
fn system_1(_: Query<&mut A>) {}
fn system_2(_: Query<&A>) {}
let mut app = App::new();
app.configure_schedules(ScheduleBuildSettings {
ambiguity_detection: LogLevel::Error,
..default()
});
app.add_systems(Update, ( system_1, system_2 ));
app.allow_ambiguous_component::<A>();
// running the app does not error.
app.update();pub fn allow_ambiguous_resource<T>(&mut self) -> &mut Appwhere
T: Resource,
pub fn allow_ambiguous_resource<T>(&mut self) -> &mut Appwhere
T: Resource,
When doing ambiguity checking this
ignores systems that are ambiguous on Resource T.
This settings only applies to the main world. To apply this to other worlds call the corresponding method on World
§Example
#[derive(Resource)]
struct R;
// these systems are ambiguous on R
fn system_1(_: ResMut<R>) {}
fn system_2(_: Res<R>) {}
let mut app = App::new();
app.configure_schedules(ScheduleBuildSettings {
ambiguity_detection: LogLevel::Error,
..default()
});
app.insert_resource(R);
app.add_systems(Update, ( system_1, system_2 ));
app.allow_ambiguous_resource::<R>();
// running the app does not error.
app.update();pub fn ignore_ambiguity<M1, M2, S1, S2>(
&mut self,
schedule: impl ScheduleLabel,
a: S1,
b: S2,
) -> &mut Appwhere
S1: IntoSystemSet<M1>,
S2: IntoSystemSet<M2>,
pub fn ignore_ambiguity<M1, M2, S1, S2>(
&mut self,
schedule: impl ScheduleLabel,
a: S1,
b: S2,
) -> &mut Appwhere
S1: IntoSystemSet<M1>,
S2: IntoSystemSet<M2>,
Suppress warnings and errors that would result from systems in these sets having ambiguities
(conflicting access but indeterminate order) with systems in set.
When possible, do this directly in the .add_systems(Update, a.ambiguous_with(b)) call.
However, sometimes two independent plugins A and B are reported as ambiguous, which you
can only suppress as the consumer of both.
pub fn should_exit(&self) -> Option<AppExit>
pub fn should_exit(&self) -> Option<AppExit>
pub fn add_observer<M>(&mut self, observer: impl IntoObserver<M>) -> &mut App
pub fn add_observer<M>(&mut self, observer: impl IntoObserver<M>) -> &mut App
Spawns an [Observer] entity, which will watch for and respond to the given event.
observer can be any system whose first parameter is [On].
§Examples
app.add_observer(|event: On<Party>, friends: Query<Entity, With<Friend>>, mut commands: Commands| {
if event.friends_allowed {
for entity in friends.iter() {
commands.trigger(Invite { entity } );
}
}
});pub fn get_error_handler(&self) -> Option<fn(BevyError, ErrorContext)>
pub fn get_error_handler(&self) -> Option<fn(BevyError, ErrorContext)>
Gets the error handler to set for new supapps.
Note that the error handler of existing subapps may differ.
pub fn set_error_handler(
&mut self,
handler: fn(BevyError, ErrorContext),
) -> &mut App
pub fn set_error_handler( &mut self, handler: fn(BevyError, ErrorContext), ) -> &mut App
Set the fallback error handler for the all subapps (including the main one and future ones) that do not have one.
May only be called once and should be set by the application, not by libraries.
The handler will be called when an error is produced and not otherwise handled.
§Panics
Panics if called multiple times.
§Example
App::new()
.set_error_handler(warn)
.add_plugins(MyPlugins)
.run();Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RanimApp
impl !RefUnwindSafe for RanimApp
impl !Send for RanimApp
impl !Sync for RanimApp
impl !UnwindSafe for RanimApp
impl Unpin for RanimApp
impl UnsafeUnpin for RanimApp
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
Source§type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
Source§fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T, C> ComponentsInto<C> for T
impl<T, C> ComponentsInto<C> for T
Source§fn components_into(self) -> C
fn components_into(self) -> C
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§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>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
§fn super_from(input: T) -> O
fn super_from(input: T) -> O
§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
§fn super_into(self) -> O
fn super_into(self) -> O
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<T> TransformedExt for T
impl<T> TransformedExt for T
Source§fn transformed<G>(self, transform: G) -> Transformed<Self, G>
fn transformed<G>(self, transform: G) -> Transformed<Self, G>
self wrapped with transform stored exactly as G.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more