From 257bbf62369258c6bbb44d331cda5396e2c463a5 Mon Sep 17 00:00:00 2001 From: Joona Aalto Date: Fri, 21 Mar 2025 00:42:25 +0200 Subject: [PATCH 1/4] Migrate to Bevy 0.16.0-rc.1 and add `no_std` support --- Cargo.toml | 17 ++++++++++++++--- README.md | 7 ++++--- examples/hermite_interpolation.rs | 2 +- src/extrapolation.rs | 2 +- src/hermite.rs | 2 +- src/lib.rs | 8 +++++++- 6 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a76527b..ca8b9b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,19 +12,25 @@ keywords = ["gamedev", "interpolation", "easing", "bevy"] categories = ["game-development"] [features] -default = [] +default = ["std"] + +# Enable the Rust standard library. +std = ["bevy/std"] + +# Enable `libm` math operations for `no_std` environments and cross-platform determinism. +libm = ["bevy/libm"] # Enable data serialization/deserialization using `serde`. serialize = ["dep:serde", "bevy/serialize"] [dependencies] -bevy = { version = "0.15", default-features = false } +bevy = { version = "0.16.0-rc.1", default-features = false } # Serialization serde = { version = "1.0", default-features = false, optional = true } [dev-dependencies] -bevy = { version = "0.15", default-features = false, features = [ +bevy = { version = "0.16.0-rc.1", default-features = false, features = [ "bevy_core_pipeline", "bevy_text", "bevy_ui", @@ -36,3 +42,8 @@ bevy = { version = "0.15", default-features = false, features = [ "bevy_window", "x11", ] } + +[lints.clippy] +std_instead_of_core = "warn" +std_instead_of_alloc = "warn" +alloc_instead_of_core = "warn" diff --git a/README.md b/README.md index 29d718a..9bd6771 100644 --- a/README.md +++ b/README.md @@ -154,9 +154,10 @@ and `NonlinearRotationEasing` marker components. Custom easing solutions can be ## Supported Bevy Versions -| `bevy` | `bevy_transform_interpolation` | -| ------ | ------------------------------ | -| 0.15 | 0.1 | +| `bevy` | `bevy_transform_interpolation` | +| ------- | ------------------------------ | +| 0.16 RC | main | +| 0.15 | 0.1 | ## License diff --git a/examples/hermite_interpolation.rs b/examples/hermite_interpolation.rs index 6066c64..060452a 100644 --- a/examples/hermite_interpolation.rs +++ b/examples/hermite_interpolation.rs @@ -24,7 +24,7 @@ use bevy_transform_interpolation::{ }; const MOVEMENT_SPEED: f32 = 250.0; -const ROTATION_SPEED: f32 = std::f32::consts::TAU * 3.0; +const ROTATION_SPEED: f32 = core::f32::consts::TAU * 3.0; fn main() { let mut app = App::new(); diff --git a/src/extrapolation.rs b/src/extrapolation.rs index b138f7d..1446c8c 100644 --- a/src/extrapolation.rs +++ b/src/extrapolation.rs @@ -3,7 +3,7 @@ //! //! See the [`TransformExtrapolationPlugin`] for more information. -use std::marker::PhantomData; +use core::marker::PhantomData; use crate::{ NoRotationEasing, NoTranslationEasing, RotationEasingState, TransformEasingPlugin, diff --git a/src/hermite.rs b/src/hermite.rs index 6333a6c..3605cdf 100644 --- a/src/hermite.rs +++ b/src/hermite.rs @@ -1,6 +1,6 @@ //! Hermite interpolation for [`Transform`] easing. -use std::{f32::consts::TAU, marker::PhantomData}; +use core::{f32::consts::TAU, marker::PhantomData}; use bevy::prelude::*; use ops::FloatPow; diff --git a/src/lib.rs b/src/lib.rs index ef2b022..7383fe0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -121,10 +121,16 @@ //! //! [`TransformHermiteEasingPlugin`]: crate::hermite::TransformHermiteEasingPlugin +#![no_std] #![expect(clippy::needless_doctest_main)] #![expect(clippy::type_complexity)] #![warn(missing_docs)] +#[cfg(feature = "std")] +extern crate std; + +extern crate alloc; + // Core interpolation and extrapolation plugins pub mod extrapolation; pub mod interpolation; @@ -150,7 +156,7 @@ pub mod prelude { }; } -use std::marker::PhantomData; +use core::marker::PhantomData; // For doc links. #[allow(unused_imports)] From 897bdad4d45ffc5ca011f70ef024d082a982788c Mon Sep 17 00:00:00 2001 From: Joona Aalto Date: Fri, 21 Mar 2025 00:48:47 +0200 Subject: [PATCH 2/4] Remove unused extern crates --- src/lib.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7383fe0..e726fa9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -126,11 +126,6 @@ #![expect(clippy::type_complexity)] #![warn(missing_docs)] -#[cfg(feature = "std")] -extern crate std; - -extern crate alloc; - // Core interpolation and extrapolation plugins pub mod extrapolation; pub mod interpolation; From 875a71d8bdc43b6b117c65c21220b4ada83dfbd7 Mon Sep 17 00:00:00 2001 From: Joona Aalto Date: Fri, 21 Mar 2025 01:06:09 +0200 Subject: [PATCH 3/4] Fix doc examples --- src/extrapolation.rs | 3 ++- src/hermite.rs | 3 ++- src/lib.rs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/extrapolation.rs b/src/extrapolation.rs index 1446c8c..f1b8b50 100644 --- a/src/extrapolation.rs +++ b/src/extrapolation.rs @@ -82,7 +82,7 @@ use bevy::prelude::*; /// /// Then, add the [`TransformExtrapolationPlugin`] to the app with the velocity sources: /// -/// ``` +/// ```no_run /// use bevy::{ecs::query::QueryData, prelude::*}; /// use bevy_transform_interpolation::{prelude::*, VelocitySource}; /// # @@ -130,6 +130,7 @@ use bevy::prelude::*; /// app.add_plugins(( /// TransformInterpolationPlugin::default(), /// TransformExtrapolationPlugin::::default(), +/// # TimePlugin::default(), /// )); /// /// // Optional: Insert velocity components automatically for entities with extrapolation. diff --git a/src/hermite.rs b/src/hermite.rs index 3605cdf..b52cd0e 100644 --- a/src/hermite.rs +++ b/src/hermite.rs @@ -91,7 +91,7 @@ use crate::{ /// Then, add the [`TransformHermiteEasingPlugin`] to the app with the velocity sources, /// along with the [`TransformInterpolationPlugin`] and/or [`TransformExtrapolationPlugin`]: /// -/// ``` +/// ```no_run /// use bevy::{ecs::query::QueryData, prelude::*}; /// use bevy_transform_interpolation::{prelude::*, VelocitySource}; /// # @@ -146,6 +146,7 @@ use crate::{ /// app.add_plugins(( /// TransformInterpolationPlugin::default(), /// TransformHermiteEasingPlugin::::default(), +/// # TimePlugin::default(), /// )); /// /// // Optional: Insert velocity components automatically for entities with Hermite interpolation. diff --git a/src/lib.rs b/src/lib.rs index e726fa9..588e16c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -56,13 +56,14 @@ //! If you want *all* entities with a [`Transform`] to be interpolated by default, you can use //! [`TransformInterpolationPlugin::interpolate_all()`]: //! -//! ``` +//! ```no_run //! # use bevy::prelude::*; //! # use bevy_transform_interpolation::prelude::*; //! # //! fn main() { //! App::new() //! .add_plugins(TransformInterpolationPlugin::interpolate_all()) +//! # .add_plugins(TimePlugin::default()) //! // ... //! .run(); //! } From 8f9f633be813178f919a06102888d1ce2659afc6 Mon Sep 17 00:00:00 2001 From: Joona Aalto Date: Fri, 21 Mar 2025 01:11:26 +0200 Subject: [PATCH 4/4] Fix import path in doc examples --- src/extrapolation.rs | 2 +- src/hermite.rs | 2 +- src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/extrapolation.rs b/src/extrapolation.rs index f1b8b50..2b74173 100644 --- a/src/extrapolation.rs +++ b/src/extrapolation.rs @@ -130,7 +130,7 @@ use bevy::prelude::*; /// app.add_plugins(( /// TransformInterpolationPlugin::default(), /// TransformExtrapolationPlugin::::default(), -/// # TimePlugin::default(), +/// # bevy::time::TimePlugin::default(), /// )); /// /// // Optional: Insert velocity components automatically for entities with extrapolation. diff --git a/src/hermite.rs b/src/hermite.rs index b52cd0e..e80c57e 100644 --- a/src/hermite.rs +++ b/src/hermite.rs @@ -146,7 +146,7 @@ use crate::{ /// app.add_plugins(( /// TransformInterpolationPlugin::default(), /// TransformHermiteEasingPlugin::::default(), -/// # TimePlugin::default(), +/// # bevy::time::TimePlugin::default(), /// )); /// /// // Optional: Insert velocity components automatically for entities with Hermite interpolation. diff --git a/src/lib.rs b/src/lib.rs index 588e16c..1827ab8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -63,7 +63,7 @@ //! fn main() { //! App::new() //! .add_plugins(TransformInterpolationPlugin::interpolate_all()) -//! # .add_plugins(TimePlugin::default()) +//! # .add_plugins(bevy::time::TimePlugin::default()) //! // ... //! .run(); //! }