Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve PhantomData held by curve adaptors #15881

Merged
merged 2 commits into from
Oct 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions crates/bevy_math/src/curve/adaptors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub struct FunctionCurve<T, F> {
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) f: F,
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) _phantom: PhantomData<T>,
pub(crate) _phantom: PhantomData<fn() -> T>,
}

impl<T, F> Debug for FunctionCurve<T, F> {
Expand Down Expand Up @@ -186,7 +186,7 @@ pub struct MapCurve<S, T, C, F> {
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) f: F,
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) _phantom: PhantomData<(S, T)>,
pub(crate) _phantom: PhantomData<(fn() -> S, fn(S) -> T)>,
}

impl<S, T, C, F> Debug for MapCurve<S, T, C, F>
Expand Down Expand Up @@ -283,7 +283,7 @@ pub struct ReparamCurve<T, C, F> {
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) f: F,
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) _phantom: PhantomData<T>,
pub(crate) _phantom: PhantomData<fn() -> T>,
}

impl<T, C, F> Debug for ReparamCurve<T, C, F>
Expand Down Expand Up @@ -377,7 +377,7 @@ pub struct LinearReparamCurve<T, C> {
/// Invariants: This interval must always be bounded.
pub(crate) new_domain: Interval,
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) _phantom: PhantomData<T>,
pub(crate) _phantom: PhantomData<fn() -> T>,
}

impl<T, C> Curve<T> for LinearReparamCurve<T, C>
Expand Down Expand Up @@ -410,7 +410,7 @@ pub struct CurveReparamCurve<T, C, D> {
pub(crate) base: C,
pub(crate) reparam_curve: D,
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) _phantom: PhantomData<T>,
pub(crate) _phantom: PhantomData<fn() -> T>,
}

impl<T, C, D> Curve<T> for CurveReparamCurve<T, C, D>
Expand Down Expand Up @@ -442,7 +442,7 @@ where
pub struct GraphCurve<T, C> {
pub(crate) base: C,
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) _phantom: PhantomData<T>,
pub(crate) _phantom: PhantomData<fn() -> T>,
}

impl<T, C> Curve<(f32, T)> for GraphCurve<T, C>
Expand Down Expand Up @@ -474,7 +474,7 @@ pub struct ZipCurve<S, T, C, D> {
pub(crate) first: C,
pub(crate) second: D,
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) _phantom: PhantomData<(S, T)>,
pub(crate) _phantom: PhantomData<fn() -> (S, T)>,
}

impl<S, T, C, D> Curve<(S, T)> for ZipCurve<S, T, C, D>
Expand Down Expand Up @@ -514,7 +514,7 @@ pub struct ChainCurve<T, C, D> {
pub(crate) first: C,
pub(crate) second: D,
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) _phantom: PhantomData<T>,
pub(crate) _phantom: PhantomData<fn() -> T>,
}

impl<T, C, D> Curve<T> for ChainCurve<T, C, D>
Expand Down Expand Up @@ -563,7 +563,7 @@ where
pub struct ReverseCurve<T, C> {
pub(crate) curve: C,
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) _phantom: PhantomData<T>,
pub(crate) _phantom: PhantomData<fn() -> T>,
}

impl<T, C> Curve<T> for ReverseCurve<T, C>
Expand Down Expand Up @@ -605,7 +605,7 @@ pub struct RepeatCurve<T, C> {
pub(crate) domain: Interval,
pub(crate) curve: C,
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) _phantom: PhantomData<T>,
pub(crate) _phantom: PhantomData<fn() -> T>,
}

impl<T, C> Curve<T> for RepeatCurve<T, C>
Expand Down Expand Up @@ -653,7 +653,7 @@ where
pub struct ForeverCurve<T, C> {
pub(crate) curve: C,
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) _phantom: PhantomData<T>,
pub(crate) _phantom: PhantomData<fn() -> T>,
}

impl<T, C> Curve<T> for ForeverCurve<T, C>
Expand Down Expand Up @@ -697,7 +697,7 @@ where
pub struct PingPongCurve<T, C> {
pub(crate) curve: C,
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) _phantom: PhantomData<T>,
pub(crate) _phantom: PhantomData<fn() -> T>,
}

impl<T, C> Curve<T> for PingPongCurve<T, C>
Expand Down Expand Up @@ -754,7 +754,7 @@ pub struct ContinuationCurve<T, C, D> {
// cache the offset in the curve directly to prevent triple sampling for every sample we make
pub(crate) offset: T,
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
pub(crate) _phantom: PhantomData<T>,
pub(crate) _phantom: PhantomData<fn() -> T>,
}

impl<T, C, D> Curve<T> for ContinuationCurve<T, C, D>
Expand Down