diff --git a/benches/benches/bevy_ecs/change_detection.rs b/benches/benches/bevy_ecs/change_detection.rs index 92f3251abc..3cfa5bcbed 100644 --- a/benches/benches/bevy_ecs/change_detection.rs +++ b/benches/benches/bevy_ecs/change_detection.rs @@ -49,6 +49,7 @@ impl BenchModify for Table { black_box(self.0) } } + impl BenchModify for Sparse { fn bench_modify(&mut self) -> f32 { self.0 += 1f32; diff --git a/crates/bevy_app/src/propagate.rs b/crates/bevy_app/src/propagate.rs index 754ba3140e..c6ac5139b9 100644 --- a/crates/bevy_app/src/propagate.rs +++ b/crates/bevy_app/src/propagate.rs @@ -88,6 +88,7 @@ impl core::fmt::Debug for PropagateSet { } impl Eq for PropagateSet {} + impl core::hash::Hash for PropagateSet { fn hash(&self, state: &mut H) { self._p.hash(state); diff --git a/crates/bevy_asset/src/direct_access_ext.rs b/crates/bevy_asset/src/direct_access_ext.rs index 792d523a30..e7e5b993de 100644 --- a/crates/bevy_asset/src/direct_access_ext.rs +++ b/crates/bevy_asset/src/direct_access_ext.rs @@ -20,6 +20,7 @@ pub trait DirectAssetAccessExt { settings: impl Fn(&mut S) + Send + Sync + 'static, ) -> Handle; } + impl DirectAssetAccessExt for World { /// Insert an asset similarly to [`Assets::add`]. /// diff --git a/crates/bevy_asset/src/io/embedded/embedded_watcher.rs b/crates/bevy_asset/src/io/embedded/embedded_watcher.rs index f7fb56be74..06a0791a50 100644 --- a/crates/bevy_asset/src/io/embedded/embedded_watcher.rs +++ b/crates/bevy_asset/src/io/embedded/embedded_watcher.rs @@ -56,6 +56,7 @@ pub(crate) struct EmbeddedEventHandler { dir: Dir, last_event: Option, } + impl FilesystemEventHandler for EmbeddedEventHandler { fn begin(&mut self) { self.last_event = None; diff --git a/crates/bevy_asset/src/io/embedded/mod.rs b/crates/bevy_asset/src/io/embedded/mod.rs index f6c44397fc..c49d55ca4a 100644 --- a/crates/bevy_asset/src/io/embedded/mod.rs +++ b/crates/bevy_asset/src/io/embedded/mod.rs @@ -141,16 +141,19 @@ impl EmbeddedAssetRegistry { pub trait GetAssetServer { fn get_asset_server(&self) -> &AssetServer; } + impl GetAssetServer for App { fn get_asset_server(&self) -> &AssetServer { self.world().get_asset_server() } } + impl GetAssetServer for World { fn get_asset_server(&self) -> &AssetServer { self.resource() } } + impl GetAssetServer for AssetServer { fn get_asset_server(&self) -> &AssetServer { self diff --git a/crates/bevy_asset/src/reflect.rs b/crates/bevy_asset/src/reflect.rs index 6c470891bd..a3148cecb7 100644 --- a/crates/bevy_asset/src/reflect.rs +++ b/crates/bevy_asset/src/reflect.rs @@ -223,6 +223,7 @@ pub struct ReflectHandle { downcast_handle_untyped: fn(&dyn Any) -> Option, typed: fn(UntypedHandle) -> Box, } + impl ReflectHandle { /// The [`TypeId`] of the asset pub fn asset_type_id(&self) -> TypeId { diff --git a/crates/bevy_audio/src/audio_output.rs b/crates/bevy_audio/src/audio_output.rs index 9fc757af44..d02d326501 100644 --- a/crates/bevy_audio/src/audio_output.rs +++ b/crates/bevy_audio/src/audio_output.rs @@ -57,6 +57,7 @@ pub struct PlaybackRemoveMarker; pub(crate) struct EarPositions<'w, 's> { pub(crate) query: Query<'w, 's, (Entity, &'static GlobalTransform, &'static SpatialListener)>, } + impl<'w, 's> EarPositions<'w, 's> { /// Gets a set of transformed ear positions. /// diff --git a/crates/bevy_core_pipeline/src/core_3d/camera_3d.rs b/crates/bevy_core_pipeline/src/core_3d/camera_3d.rs index 9bcb2b4f80..f5314c736d 100644 --- a/crates/bevy_core_pipeline/src/core_3d/camera_3d.rs +++ b/crates/bevy_core_pipeline/src/core_3d/camera_3d.rs @@ -80,6 +80,7 @@ impl From for Camera3dDepthTextureUsage { Self(value.bits()) } } + impl From for TextureUsages { fn from(value: Camera3dDepthTextureUsage) -> Self { Self::from_bits_truncate(value.0) diff --git a/crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs b/crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs index a632c1b49a..df195a6122 100644 --- a/crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs +++ b/crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs @@ -17,11 +17,13 @@ pub struct FrameTimeDiagnosticsPlugin { /// The smoothing factor for the exponential moving average. Usually `2.0 / (history_length + 1.0)`. pub smoothing_factor: f64, } + impl Default for FrameTimeDiagnosticsPlugin { fn default() -> Self { Self::new(DEFAULT_MAX_HISTORY_LENGTH) } } + impl FrameTimeDiagnosticsPlugin { /// Creates a new `FrameTimeDiagnosticsPlugin` with the specified `max_history_length` and a /// reasonable `smoothing_factor`. diff --git a/crates/bevy_ecs/src/archetype.rs b/crates/bevy_ecs/src/archetype.rs index 34a2a4c813..1ecbad16a1 100644 --- a/crates/bevy_ecs/src/archetype.rs +++ b/crates/bevy_ecs/src/archetype.rs @@ -960,6 +960,7 @@ impl Index> for Archetypes { &self.archetypes[index.start.0.index()..] } } + impl Index for Archetypes { type Output = Archetype; diff --git a/crates/bevy_ecs/src/component.rs b/crates/bevy_ecs/src/component.rs index cfcde29ab2..831402240d 100644 --- a/crates/bevy_ecs/src/component.rs +++ b/crates/bevy_ecs/src/component.rs @@ -623,6 +623,7 @@ pub trait ComponentMutability: private::Seal + 'static { pub struct Immutable; impl private::Seal for Immutable {} + impl ComponentMutability for Immutable { const MUTABLE: bool = false; } @@ -633,6 +634,7 @@ impl ComponentMutability for Immutable { pub struct Mutable; impl private::Seal for Mutable {} + impl ComponentMutability for Mutable { const MUTABLE: bool = true; } @@ -2968,6 +2970,7 @@ impl Default for DefaultCloneBehaviorSpecialization { pub trait DefaultCloneBehaviorBase { fn default_clone_behavior(&self) -> ComponentCloneBehavior; } + impl DefaultCloneBehaviorBase for DefaultCloneBehaviorSpecialization { fn default_clone_behavior(&self) -> ComponentCloneBehavior { ComponentCloneBehavior::Default @@ -2979,6 +2982,7 @@ impl DefaultCloneBehaviorBase for DefaultCloneBehaviorSpecialization { pub trait DefaultCloneBehaviorViaClone { fn default_clone_behavior(&self) -> ComponentCloneBehavior; } + impl DefaultCloneBehaviorViaClone for &DefaultCloneBehaviorSpecialization { fn default_clone_behavior(&self) -> ComponentCloneBehavior { ComponentCloneBehavior::clone::() diff --git a/crates/bevy_ecs/src/entity/mod.rs b/crates/bevy_ecs/src/entity/mod.rs index 02d9698917..700a4e517f 100644 --- a/crates/bevy_ecs/src/entity/mod.rs +++ b/crates/bevy_ecs/src/entity/mod.rs @@ -718,6 +718,7 @@ impl<'a> Iterator for ReserveEntitiesIterator<'a> { } impl<'a> ExactSizeIterator for ReserveEntitiesIterator<'a> {} + impl<'a> core::iter::FusedIterator for ReserveEntitiesIterator<'a> {} // SAFETY: Newly reserved entity values are unique. diff --git a/crates/bevy_ecs/src/entity/unique_array.rs b/crates/bevy_ecs/src/entity/unique_array.rs index ce31e55448..71df33ec5f 100644 --- a/crates/bevy_ecs/src/entity/unique_array.rs +++ b/crates/bevy_ecs/src/entity/unique_array.rs @@ -154,6 +154,7 @@ impl DerefMut for UniqueEntityEquivalentArr unsafe { UniqueEntityEquivalentSlice::from_slice_unchecked_mut(&mut self.0) } } } + impl Default for UniqueEntityEquivalentArray { fn default() -> Self { Self(Default::default()) @@ -527,6 +528,7 @@ impl, U: EntityEquivalent, const N: usize> self.eq(&other.0) } } + impl, U: EntityEquivalent, const N: usize> PartialEq<&UniqueEntityEquivalentArray> for VecDeque { @@ -550,6 +552,7 @@ impl, U: EntityEquivalent, const N: usize> self.eq(&other.0) } } + impl, U: EntityEquivalent, const N: usize> PartialEq> for VecDeque { diff --git a/crates/bevy_ecs/src/name.rs b/crates/bevy_ecs/src/name.rs index 67719ca18d..317c8f5017 100644 --- a/crates/bevy_ecs/src/name.rs +++ b/crates/bevy_ecs/src/name.rs @@ -159,6 +159,7 @@ impl From<&str> for Name { Name::new(name.to_owned()) } } + impl From for Name { #[inline(always)] fn from(name: String) -> Self { @@ -174,12 +175,14 @@ impl AsRef for Name { &self.name } } + impl From<&Name> for String { #[inline(always)] fn from(val: &Name) -> String { val.as_str().to_owned() } } + impl From for String { #[inline(always)] fn from(val: Name) -> String { diff --git a/crates/bevy_ecs/src/query/fetch.rs b/crates/bevy_ecs/src/query/fetch.rs index 0a13b61819..2564223972 100644 --- a/crates/bevy_ecs/src/query/fetch.rs +++ b/crates/bevy_ecs/src/query/fetch.rs @@ -1489,6 +1489,7 @@ impl Clone for ReadFetch<'_, T> { *self } } + impl Copy for ReadFetch<'_, T> {} /// SAFETY: @@ -1665,6 +1666,7 @@ impl Clone for RefFetch<'_, T> { *self } } + impl Copy for RefFetch<'_, T> {} /// SAFETY: @@ -1873,6 +1875,7 @@ impl Clone for WriteFetch<'_, T> { *self } } + impl Copy for WriteFetch<'_, T> {} /// SAFETY: diff --git a/crates/bevy_ecs/src/query/filter.rs b/crates/bevy_ecs/src/query/filter.rs index 312b330e04..f9f4861b79 100644 --- a/crates/bevy_ecs/src/query/filter.rs +++ b/crates/bevy_ecs/src/query/filter.rs @@ -1240,6 +1240,7 @@ unsafe impl QueryFilter for Spawned { pub trait ArchetypeFilter: QueryFilter {} impl ArchetypeFilter for With {} + impl ArchetypeFilter for Without {} macro_rules! impl_archetype_filter_tuple { diff --git a/crates/bevy_ecs/src/schedule/pass.rs b/crates/bevy_ecs/src/schedule/pass.rs index 20680e04e0..a602877d65 100644 --- a/crates/bevy_ecs/src/schedule/pass.rs +++ b/crates/bevy_ecs/src/schedule/pass.rs @@ -51,6 +51,7 @@ pub(super) trait ScheduleBuildPassObj: Send + Sync + Debug { ); fn add_dependency(&mut self, from: NodeId, to: NodeId, all_options: &TypeIdMap>); } + impl ScheduleBuildPassObj for T { fn build( &mut self, diff --git a/crates/bevy_ecs/src/schedule/schedule.rs b/crates/bevy_ecs/src/schedule/schedule.rs index 3c67f1ea07..4455aba2fe 100644 --- a/crates/bevy_ecs/src/schedule/schedule.rs +++ b/crates/bevy_ecs/src/schedule/schedule.rs @@ -235,6 +235,7 @@ pub enum Chain { /// will be added between the successive elements. Chained(TypeIdMap>), } + impl Chain { /// Specify that the systems must be chained. pub fn set_chained(&mut self) { diff --git a/crates/bevy_ecs/src/spawn.rs b/crates/bevy_ecs/src/spawn.rs index d5014f2240..0c30c14b9c 100644 --- a/crates/bevy_ecs/src/spawn.rs +++ b/crates/bevy_ecs/src/spawn.rs @@ -210,6 +210,7 @@ unsafe impl + Send + Sync + 'static> Bundle ); } } + impl> DynamicBundle for SpawnRelatedBundle { type Effect = Self; diff --git a/crates/bevy_ecs/src/system/observer_system.rs b/crates/bevy_ecs/src/system/observer_system.rs index 8e927d9529..243c2c3c3f 100644 --- a/crates/bevy_ecs/src/system/observer_system.rs +++ b/crates/bevy_ecs/src/system/observer_system.rs @@ -73,6 +73,7 @@ where InfallibleObserverWrapper::new(IntoSystem::into_system(this)) } } + impl IntoObserverSystem for S where S: IntoSystem, Never, M> + Send + 'static, diff --git a/crates/bevy_ecs/src/system/system_param.rs b/crates/bevy_ecs/src/system/system_param.rs index 8faa6f1b0c..d86d71b9d6 100644 --- a/crates/bevy_ecs/src/system/system_param.rs +++ b/crates/bevy_ecs/src/system/system_param.rs @@ -1400,6 +1400,7 @@ impl<'w, T> Deref for NonSend<'w, T> { self.value } } + impl<'a, T> From> for NonSend<'a, T> { fn from(nsm: NonSendMut<'a, T>) -> Self { Self { diff --git a/crates/bevy_gilrs/src/lib.rs b/crates/bevy_gilrs/src/lib.rs index 9b86edf03a..7ec1c2e93b 100644 --- a/crates/bevy_gilrs/src/lib.rs +++ b/crates/bevy_gilrs/src/lib.rs @@ -47,6 +47,7 @@ pub(crate) struct Gilrs { #[cfg(not(target_arch = "wasm32"))] cell: SyncCell, } + impl Gilrs { #[inline] pub fn with(&mut self, f: impl FnOnce(&mut gilrs::Gilrs)) { diff --git a/crates/bevy_gizmos/src/grid.rs b/crates/bevy_gizmos/src/grid.rs index cdcfc41236..2c85a0859d 100644 --- a/crates/bevy_gizmos/src/grid.rs +++ b/crates/bevy_gizmos/src/grid.rs @@ -172,6 +172,7 @@ where ); } } + impl GizmoBuffer where Config: GizmoConfigGroup, diff --git a/crates/bevy_image/src/texture_atlas.rs b/crates/bevy_image/src/texture_atlas.rs index 4caeed8c07..67e1b20317 100644 --- a/crates/bevy_image/src/texture_atlas.rs +++ b/crates/bevy_image/src/texture_atlas.rs @@ -34,6 +34,7 @@ pub struct TextureAtlasSources { /// Maps from a specific image handle to the index in `textures` where they can be found. pub texture_ids: HashMap, usize>, } + impl TextureAtlasSources { /// Retrieves the texture *section* index of the given `texture` handle. pub fn texture_index(&self, texture: impl Into>) -> Option { diff --git a/crates/bevy_math/src/cubic_splines/mod.rs b/crates/bevy_math/src/cubic_splines/mod.rs index 1b04603a73..3ea99a60b0 100644 --- a/crates/bevy_math/src/cubic_splines/mod.rs +++ b/crates/bevy_math/src/cubic_splines/mod.rs @@ -1347,6 +1347,7 @@ pub struct RationalSegment { /// The width of the domain of this segment. pub knot_span: f32, } + impl> RationalSegment

{ /// Instantaneous position of a point at parametric value `t` in `[0, 1]`. #[inline] diff --git a/crates/bevy_math/src/primitives/dim2.rs b/crates/bevy_math/src/primitives/dim2.rs index d666849840..9cb379706c 100644 --- a/crates/bevy_math/src/primitives/dim2.rs +++ b/crates/bevy_math/src/primitives/dim2.rs @@ -35,6 +35,7 @@ pub struct Circle { /// The radius of the circle pub radius: f32, } + impl Primitive2d for Circle {} impl Default for Circle { @@ -124,6 +125,7 @@ pub struct Arc2d { /// Half the angle defining the arc pub half_angle: f32, } + impl Primitive2d for Arc2d {} impl Default for Arc2d { @@ -290,6 +292,7 @@ pub struct CircularSector { #[cfg_attr(all(feature = "serialize", feature = "alloc"), serde(flatten))] pub arc: Arc2d, } + impl Primitive2d for CircularSector {} impl Default for CircularSector { @@ -433,6 +436,7 @@ pub struct CircularSegment { #[cfg_attr(all(feature = "serialize", feature = "alloc"), serde(flatten))] pub arc: Arc2d, } + impl Primitive2d for CircularSegment {} impl Default for CircularSegment { @@ -453,6 +457,7 @@ impl Measured2d for CircularSegment { self.chord_length() + self.arc_length() } } + impl CircularSegment { /// Create a new [`CircularSegment`] from a `radius`, and an `angle` #[inline(always)] @@ -788,6 +793,7 @@ pub struct Ellipse { /// This corresponds to the two perpendicular radii defining the ellipse. pub half_size: Vec2, } + impl Primitive2d for Ellipse {} impl Default for Ellipse { @@ -939,6 +945,7 @@ pub struct Annulus { /// The outer circle of the annulus pub outer_circle: Circle, } + impl Primitive2d for Annulus {} impl Default for Annulus { @@ -1036,6 +1043,7 @@ pub struct Rhombus { /// Size of the horizontal and vertical diagonals of the rhombus pub half_diagonals: Vec2, } + impl Primitive2d for Rhombus {} impl Default for Rhombus { @@ -1171,6 +1179,7 @@ pub struct Plane2d { /// The normal of the plane. The plane will be placed perpendicular to this direction pub normal: Dir2, } + impl Primitive2d for Plane2d {} impl Default for Plane2d { @@ -1213,6 +1222,7 @@ pub struct Line2d { /// and its opposite direction pub direction: Dir2, } + impl Primitive2d for Line2d {} /// A line segment defined by two endpoints in 2D space. @@ -1232,6 +1242,7 @@ pub struct Segment2d { /// The endpoints of the line segment. pub vertices: [Vec2; 2], } + impl Primitive2d for Segment2d {} impl Segment2d { @@ -1504,6 +1515,7 @@ pub struct Polyline2d { #[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))] pub vertices: [Vec2; N], } + impl Primitive2d for Polyline2d {} impl FromIterator for Polyline2d { @@ -1573,6 +1585,7 @@ pub struct Triangle2d { /// The vertices of the triangle pub vertices: [Vec2; 3], } + impl Primitive2d for Triangle2d {} impl Default for Triangle2d { @@ -1745,6 +1758,7 @@ pub struct Rectangle { /// Half of the width and height of the rectangle pub half_size: Vec2, } + impl Primitive2d for Rectangle {} impl Default for Rectangle { @@ -1838,6 +1852,7 @@ pub struct Polygon { #[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))] pub vertices: [Vec2; N], } + impl Primitive2d for Polygon {} impl FromIterator for Polygon { @@ -1892,6 +1907,7 @@ pub struct ConvexPolygon { #[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))] vertices: [Vec2; N], } + impl Primitive2d for ConvexPolygon {} /// An error that happens when creating a [`ConvexPolygon`]. @@ -2013,6 +2029,7 @@ pub struct RegularPolygon { /// The number of sides pub sides: u32, } + impl Primitive2d for RegularPolygon {} impl Default for RegularPolygon { @@ -2160,6 +2177,7 @@ pub struct Capsule2d { /// Half the height of the capsule, excluding the semicircles pub half_length: f32, } + impl Primitive2d for Capsule2d {} impl Default for Capsule2d { diff --git a/crates/bevy_math/src/primitives/dim3.rs b/crates/bevy_math/src/primitives/dim3.rs index ea5ccd6e2d..86aa6c5bdf 100644 --- a/crates/bevy_math/src/primitives/dim3.rs +++ b/crates/bevy_math/src/primitives/dim3.rs @@ -31,6 +31,7 @@ pub struct Sphere { /// The radius of the sphere pub radius: f32, } + impl Primitive3d for Sphere {} impl Default for Sphere { @@ -105,6 +106,7 @@ pub struct Plane3d { /// Half of the width and height of the plane pub half_size: Vec2, } + impl Primitive3d for Plane3d {} impl Default for Plane3d { @@ -175,6 +177,7 @@ pub struct InfinitePlane3d { /// The normal of the plane. The plane will be placed perpendicular to this direction pub normal: Dir3, } + impl Primitive3d for InfinitePlane3d {} impl Default for InfinitePlane3d { @@ -351,6 +354,7 @@ pub struct Line3d { /// The direction of the line pub direction: Dir3, } + impl Primitive3d for Line3d {} /// A line segment defined by two endpoints in 3D space. @@ -370,6 +374,7 @@ pub struct Segment3d { /// The endpoints of the line segment. pub vertices: [Vec3; 2], } + impl Primitive3d for Segment3d {} impl Segment3d { @@ -578,6 +583,7 @@ pub struct Polyline3d { #[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))] pub vertices: [Vec3; N], } + impl Primitive3d for Polyline3d {} impl FromIterator for Polyline3d { @@ -648,6 +654,7 @@ pub struct Cuboid { /// Half of the width, height and depth of the cuboid pub half_size: Vec3, } + impl Primitive3d for Cuboid {} impl Default for Cuboid { @@ -742,6 +749,7 @@ pub struct Cylinder { /// The half height of the cylinder pub half_height: f32, } + impl Primitive3d for Cylinder {} impl Default for Cylinder { @@ -820,6 +828,7 @@ pub struct Capsule3d { /// Half the height of the capsule, excluding the hemispheres pub half_length: f32, } + impl Primitive3d for Capsule3d {} impl Default for Capsule3d { @@ -890,6 +899,7 @@ pub struct Cone { /// The height of the cone pub height: f32, } + impl Primitive3d for Cone {} impl Default for Cone { @@ -974,6 +984,7 @@ pub struct ConicalFrustum { /// The height of the frustum pub height: f32, } + impl Primitive3d for ConicalFrustum {} impl Default for ConicalFrustum { @@ -1030,6 +1041,7 @@ pub struct Torus { #[doc(alias = "radius_of_revolution")] pub major_radius: f32, } + impl Primitive3d for Torus {} impl Default for Torus { @@ -1326,6 +1338,7 @@ pub struct Tetrahedron { /// The vertices of the tetrahedron. pub vertices: [Vec3; 4], } + impl Primitive3d for Tetrahedron {} impl Default for Tetrahedron { @@ -1433,6 +1446,7 @@ pub struct Extrusion { /// Half of the depth of the extrusion pub half_depth: f32, } + impl Primitive3d for Extrusion {} impl Extrusion { diff --git a/crates/bevy_math/src/primitives/polygon.rs b/crates/bevy_math/src/primitives/polygon.rs index 20d35b552c..9aa261b297 100644 --- a/crates/bevy_math/src/primitives/polygon.rs +++ b/crates/bevy_math/src/primitives/polygon.rs @@ -34,6 +34,7 @@ struct SweepLineEvent { /// Type of the vertex (left or right) endpoint: Endpoint, } + impl SweepLineEvent { #[cfg_attr( not(feature = "alloc"), @@ -46,17 +47,21 @@ impl SweepLineEvent { } } } + impl PartialEq for SweepLineEvent { fn eq(&self, other: &Self) -> bool { self.position() == other.position() } } + impl Eq for SweepLineEvent {} + impl PartialOrd for SweepLineEvent { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } } + impl Ord for SweepLineEvent { fn cmp(&self, other: &Self) -> Ordering { xy_order(self.position(), other.position()) @@ -129,11 +134,13 @@ struct Segment { left: Vec2, right: Vec2, } + impl PartialEq for Segment { fn eq(&self, other: &Self) -> bool { self.edge_index == other.edge_index } } + impl Eq for Segment {} impl PartialOrd for Segment { @@ -141,6 +148,7 @@ impl PartialOrd for Segment { Some(self.cmp(other)) } } + impl Ord for Segment { fn cmp(&self, other: &Self) -> Ordering { self.left diff --git a/crates/bevy_mesh/src/index.rs b/crates/bevy_mesh/src/index.rs index d2497e2c50..ca84d63bfb 100644 --- a/crates/bevy_mesh/src/index.rs +++ b/crates/bevy_mesh/src/index.rs @@ -163,6 +163,7 @@ impl Iterator for IndicesIter<'_> { } impl<'a> ExactSizeIterator for IndicesIter<'a> {} + impl<'a> FusedIterator for IndicesIter<'a> {} impl From<&Indices> for IndexFormat { diff --git a/crates/bevy_mesh/src/morph.rs b/crates/bevy_mesh/src/morph.rs index a8ff3be037..fdeeeacc31 100644 --- a/crates/bevy_mesh/src/morph.rs +++ b/crates/bevy_mesh/src/morph.rs @@ -117,6 +117,7 @@ pub struct MorphWeights { /// The first mesh primitive assigned to these weights first_mesh: Option>, } + impl MorphWeights { pub fn new( weights: Vec, @@ -160,6 +161,7 @@ impl MorphWeights { pub struct MeshMorphWeights { weights: Vec, } + impl MeshMorphWeights { pub fn new(weights: Vec) -> Result { if weights.len() > MAX_MORPH_WEIGHTS { @@ -198,6 +200,7 @@ pub struct MorphAttributes { /// animated, as the `w` component is the sign and cannot be animated. pub tangent: Vec3, } + impl From<[Vec3; 3]> for MorphAttributes { fn from([position, normal, tangent]: [Vec3; 3]) -> Self { MorphAttributes { @@ -207,6 +210,7 @@ impl From<[Vec3; 3]> for MorphAttributes { } } } + impl MorphAttributes { /// How many components `MorphAttributes` has. /// diff --git a/crates/bevy_pbr/src/light/ambient_light.rs b/crates/bevy_pbr/src/light/ambient_light.rs index db255722b3..cfbe99963b 100644 --- a/crates/bevy_pbr/src/light/ambient_light.rs +++ b/crates/bevy_pbr/src/light/ambient_light.rs @@ -48,6 +48,7 @@ impl Default for AmbientLight { } } } + impl AmbientLight { pub const NONE: AmbientLight = AmbientLight { color: Color::WHITE, diff --git a/crates/bevy_pbr/src/parallax.rs b/crates/bevy_pbr/src/parallax.rs index 0a847b7c25..be588ca87c 100644 --- a/crates/bevy_pbr/src/parallax.rs +++ b/crates/bevy_pbr/src/parallax.rs @@ -33,6 +33,7 @@ pub enum ParallaxMappingMethod { max_steps: u32, }, } + impl ParallaxMappingMethod { /// [`ParallaxMappingMethod::Relief`] with a 5 steps, a reasonable default. pub const DEFAULT_RELIEF_MAPPING: Self = ParallaxMappingMethod::Relief { max_steps: 5 }; diff --git a/crates/bevy_ptr/src/lib.rs b/crates/bevy_ptr/src/lib.rs index 704d60d675..15a193d737 100644 --- a/crates/bevy_ptr/src/lib.rs +++ b/crates/bevy_ptr/src/lib.rs @@ -27,7 +27,9 @@ pub struct Unaligned; /// Trait that is only implemented for [`Aligned`] and [`Unaligned`] to work around the lack of ability /// to have const generics of an enum. pub trait IsAligned: sealed::Sealed {} + impl IsAligned for Aligned {} + impl IsAligned for Unaligned {} mod sealed { diff --git a/crates/bevy_reflect/src/func/dynamic_function.rs b/crates/bevy_reflect/src/func/dynamic_function.rs index 054e8ffaff..ab1d70e4ed 100644 --- a/crates/bevy_reflect/src/func/dynamic_function.rs +++ b/crates/bevy_reflect/src/func/dynamic_function.rs @@ -439,6 +439,7 @@ impl PartialReflect for DynamicFunction<'static> { } impl MaybeTyped for DynamicFunction<'static> {} + impl RegisterForReflection for DynamicFunction<'static> {} impl_type_path!((in bevy_reflect) DynamicFunction<'env>); diff --git a/crates/bevy_reflect/src/func/signature.rs b/crates/bevy_reflect/src/func/signature.rs index 9102049eee..cedeaca952 100644 --- a/crates/bevy_reflect/src/func/signature.rs +++ b/crates/bevy_reflect/src/func/signature.rs @@ -90,6 +90,7 @@ impl<'a, 'b> ArgListSignature<'a, 'b> { } impl Eq for ArgListSignature<'_, '_> {} + impl PartialEq for ArgListSignature<'_, '_> { fn eq(&self, other: &Self) -> bool { self.len() == other.len() && self.iter().eq(other.iter()) diff --git a/crates/bevy_reflect/src/impls/smallvec.rs b/crates/bevy_reflect/src/impls/smallvec.rs index 942bcbe83f..561111a901 100644 --- a/crates/bevy_reflect/src/impls/smallvec.rs +++ b/crates/bevy_reflect/src/impls/smallvec.rs @@ -77,6 +77,7 @@ where .collect() } } + impl PartialReflect for SmallVec where T::Item: FromReflect + MaybeTyped + TypePath, diff --git a/crates/bevy_reflect/src/kind.rs b/crates/bevy_reflect/src/kind.rs index 3764e863ba..8988b30aa5 100644 --- a/crates/bevy_reflect/src/kind.rs +++ b/crates/bevy_reflect/src/kind.rs @@ -220,6 +220,7 @@ pub enum ReflectRef<'a> { /// [opaque]: ReflectKind::Opaque Opaque(&'a dyn PartialReflect), } + impl_reflect_kind_conversions!(ReflectRef<'_>); impl<'a> ReflectRef<'a> { @@ -285,6 +286,7 @@ pub enum ReflectMut<'a> { /// [opaque]: ReflectKind::Opaque Opaque(&'a mut dyn PartialReflect), } + impl_reflect_kind_conversions!(ReflectMut<'_>); impl<'a> ReflectMut<'a> { @@ -350,6 +352,7 @@ pub enum ReflectOwned { /// [opaque]: ReflectKind::Opaque Opaque(Box), } + impl_reflect_kind_conversions!(ReflectOwned); impl ReflectOwned { diff --git a/crates/bevy_reflect/src/path/error.rs b/crates/bevy_reflect/src/path/error.rs index 0e900c8315..00188a4cc3 100644 --- a/crates/bevy_reflect/src/path/error.rs +++ b/crates/bevy_reflect/src/path/error.rs @@ -74,6 +74,7 @@ impl<'a> AccessError<'a> { self.offset.as_ref() } } + impl fmt::Display for AccessError<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let AccessError { @@ -126,4 +127,5 @@ impl fmt::Display for AccessError<'_> { } } } + impl core::error::Error for AccessError<'_> {} diff --git a/crates/bevy_reflect/src/path/mod.rs b/crates/bevy_reflect/src/path/mod.rs index a52bbb6aaa..f0434686ee 100644 --- a/crates/bevy_reflect/src/path/mod.rs +++ b/crates/bevy_reflect/src/path/mod.rs @@ -82,6 +82,7 @@ pub trait ReflectPath<'a>: Sized { }) } } + impl<'a> ReflectPath<'a> for &'a str { fn reflect_element(self, mut root: &dyn PartialReflect) -> PathResult<'a, &dyn PartialReflect> { for (access, offset) in PathParser::new(self) { @@ -437,6 +438,7 @@ impl ParsedPath { Ok(Self(parts)) } } + impl<'a> ReflectPath<'a> for &'a ParsedPath { fn reflect_element(self, mut root: &dyn PartialReflect) -> PathResult<'a, &dyn PartialReflect> { for OffsetAccess { access, offset } in &self.0 { @@ -454,11 +456,13 @@ impl<'a> ReflectPath<'a> for &'a ParsedPath { Ok(root) } } + impl From<[OffsetAccess; N]> for ParsedPath { fn from(value: [OffsetAccess; N]) -> Self { ParsedPath(value.to_vec()) } } + impl From>> for ParsedPath { fn from(value: Vec>) -> Self { ParsedPath( @@ -472,6 +476,7 @@ impl From>> for ParsedPath { ) } } + impl From<[Access<'static>; N]> for ParsedPath { fn from(value: [Access<'static>; N]) -> Self { value.to_vec().into() @@ -493,12 +498,14 @@ impl fmt::Display for ParsedPath { Ok(()) } } + impl core::ops::Index for ParsedPath { type Output = OffsetAccess; fn index(&self, index: usize) -> &Self::Output { &self.0[index] } } + impl core::ops::IndexMut for ParsedPath { fn index_mut(&mut self, index: usize) -> &mut Self::Output { &mut self.0[index] diff --git a/crates/bevy_reflect/src/path/parse.rs b/crates/bevy_reflect/src/path/parse.rs index 2ab2939a30..be5856834a 100644 --- a/crates/bevy_reflect/src/path/parse.rs +++ b/crates/bevy_reflect/src/path/parse.rs @@ -38,6 +38,7 @@ pub(super) struct PathParser<'a> { path: &'a str, remaining: &'a [u8], } + impl<'a> PathParser<'a> { pub(super) fn new(path: &'a str) -> Self { let remaining = path.as_bytes(); @@ -103,6 +104,7 @@ impl<'a> PathParser<'a> { self.path.len() - self.remaining.len() } } + impl<'a> Iterator for PathParser<'a> { type Item = (Result, ReflectPathError<'a>>, usize); @@ -149,6 +151,7 @@ enum Token<'a> { CloseBracket = b']', Ident(Ident<'a>), } + impl fmt::Display for Token<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { @@ -160,6 +163,7 @@ impl fmt::Display for Token<'_> { } } } + impl<'a> Token<'a> { const SYMBOLS: &'static [u8] = b".#[]"; fn symbol_from_byte(byte: u8) -> Option { diff --git a/crates/bevy_reflect/src/tuple.rs b/crates/bevy_reflect/src/tuple.rs index 51f402c698..97da69b5e2 100644 --- a/crates/bevy_reflect/src/tuple.rs +++ b/crates/bevy_reflect/src/tuple.rs @@ -649,17 +649,29 @@ macro_rules! impl_reflect_tuple { } impl_reflect_tuple! {} + impl_reflect_tuple! {0: A} + impl_reflect_tuple! {0: A, 1: B} + impl_reflect_tuple! {0: A, 1: B, 2: C} + impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D} + impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E} + impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F} + impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G} + impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H} + impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I} + impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J} + impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J, 10: K} + impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J, 10: K, 11: L} macro_rules! impl_type_path_tuple { diff --git a/crates/bevy_reflect/src/type_registry.rs b/crates/bevy_reflect/src/type_registry.rs index 1f18396be2..a20074b827 100644 --- a/crates/bevy_reflect/src/type_registry.rs +++ b/crates/bevy_reflect/src/type_registry.rs @@ -689,6 +689,7 @@ pub trait TypeData: Downcast + Send + Sync { /// Creates a type-erased clone of this value. fn clone_type_data(&self) -> Box; } + impl_downcast!(TypeData); impl TypeData for T diff --git a/crates/bevy_render/src/render_resource/gpu_array_buffer.rs b/crates/bevy_render/src/render_resource/gpu_array_buffer.rs index 195920ee0c..0c5bf36bf6 100644 --- a/crates/bevy_render/src/render_resource/gpu_array_buffer.rs +++ b/crates/bevy_render/src/render_resource/gpu_array_buffer.rs @@ -14,6 +14,7 @@ use wgpu::{BindingResource, BufferUsages}; /// Trait for types able to go in a [`GpuArrayBuffer`]. pub trait GpuArrayBufferable: ShaderType + ShaderSize + WriteInto + Clone {} + impl GpuArrayBufferable for T {} /// Stores an array of elements to be transferred to the GPU and made accessible to shaders as a read-only array. diff --git a/crates/bevy_tasks/src/executor.rs b/crates/bevy_tasks/src/executor.rs index 9a9f4f9dfa..01bbe4a669 100644 --- a/crates/bevy_tasks/src/executor.rs +++ b/crates/bevy_tasks/src/executor.rs @@ -65,9 +65,11 @@ impl LocalExecutor<'_> { } impl UnwindSafe for Executor<'_> {} + impl RefUnwindSafe for Executor<'_> {} impl UnwindSafe for LocalExecutor<'_> {} + impl RefUnwindSafe for LocalExecutor<'_> {} impl fmt::Debug for Executor<'_> { diff --git a/crates/bevy_tasks/src/lib.rs b/crates/bevy_tasks/src/lib.rs index ce9aa78883..66899ef36f 100644 --- a/crates/bevy_tasks/src/lib.rs +++ b/crates/bevy_tasks/src/lib.rs @@ -32,6 +32,7 @@ pub use conditional_send::*; /// Use [`ConditionalSendFuture`] for a future with an optional Send trait bound, as on certain platforms (eg. Wasm), /// futures aren't Send. pub trait ConditionalSendFuture: Future + ConditionalSend {} + impl ConditionalSendFuture for T {} use alloc::boxed::Box; diff --git a/crates/bevy_tasks/src/thread_executor.rs b/crates/bevy_tasks/src/thread_executor.rs index 48fb3e2861..86d2ab280d 100644 --- a/crates/bevy_tasks/src/thread_executor.rs +++ b/crates/bevy_tasks/src/thread_executor.rs @@ -24,7 +24,7 @@ use futures_lite::Future; /// // we cannot get the ticker from another thread /// let not_thread_ticker = thread_executor.ticker(); /// assert!(not_thread_ticker.is_none()); -/// +/// /// // but we can spawn tasks from another thread /// thread_executor.spawn(async move { /// count_clone.fetch_add(1, Ordering::Relaxed); @@ -98,6 +98,7 @@ pub struct ThreadExecutorTicker<'task, 'ticker> { // make type not send or sync _marker: PhantomData<*const ()>, } + impl<'task, 'ticker> ThreadExecutorTicker<'task, 'ticker> { /// Tick the thread executor. pub async fn tick(&self) { diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index d81f80f8b9..6418f69ff8 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -1043,9 +1043,11 @@ pub enum BoxSizing { /// Length styles like width and height refer to the "content box" size (size excluding padding and border) ContentBox, } + impl BoxSizing { pub const DEFAULT: Self = Self::BorderBox; } + impl Default for BoxSizing { fn default() -> Self { Self::DEFAULT diff --git a/crates/bevy_window/src/event.rs b/crates/bevy_window/src/event.rs index 81360ef9c4..89f219d269 100644 --- a/crates/bevy_window/src/event.rs +++ b/crates/bevy_window/src/event.rs @@ -570,131 +570,157 @@ impl From for WindowEvent { Self::AppLifecycle(e) } } + impl From for WindowEvent { fn from(e: CursorEntered) -> Self { Self::CursorEntered(e) } } + impl From for WindowEvent { fn from(e: CursorLeft) -> Self { Self::CursorLeft(e) } } + impl From for WindowEvent { fn from(e: CursorMoved) -> Self { Self::CursorMoved(e) } } + impl From for WindowEvent { fn from(e: FileDragAndDrop) -> Self { Self::FileDragAndDrop(e) } } + impl From for WindowEvent { fn from(e: Ime) -> Self { Self::Ime(e) } } + impl From for WindowEvent { fn from(e: RequestRedraw) -> Self { Self::RequestRedraw(e) } } + impl From for WindowEvent { fn from(e: WindowBackendScaleFactorChanged) -> Self { Self::WindowBackendScaleFactorChanged(e) } } + impl From for WindowEvent { fn from(e: WindowCloseRequested) -> Self { Self::WindowCloseRequested(e) } } + impl From for WindowEvent { fn from(e: WindowCreated) -> Self { Self::WindowCreated(e) } } + impl From for WindowEvent { fn from(e: WindowDestroyed) -> Self { Self::WindowDestroyed(e) } } + impl From for WindowEvent { fn from(e: WindowFocused) -> Self { Self::WindowFocused(e) } } + impl From for WindowEvent { fn from(e: WindowMoved) -> Self { Self::WindowMoved(e) } } + impl From for WindowEvent { fn from(e: WindowOccluded) -> Self { Self::WindowOccluded(e) } } + impl From for WindowEvent { fn from(e: WindowResized) -> Self { Self::WindowResized(e) } } + impl From for WindowEvent { fn from(e: WindowScaleFactorChanged) -> Self { Self::WindowScaleFactorChanged(e) } } + impl From for WindowEvent { fn from(e: WindowThemeChanged) -> Self { Self::WindowThemeChanged(e) } } + impl From for WindowEvent { fn from(e: MouseButtonInput) -> Self { Self::MouseButtonInput(e) } } + impl From for WindowEvent { fn from(e: MouseMotion) -> Self { Self::MouseMotion(e) } } + impl From for WindowEvent { fn from(e: MouseWheel) -> Self { Self::MouseWheel(e) } } + impl From for WindowEvent { fn from(e: PinchGesture) -> Self { Self::PinchGesture(e) } } + impl From for WindowEvent { fn from(e: RotationGesture) -> Self { Self::RotationGesture(e) } } + impl From for WindowEvent { fn from(e: DoubleTapGesture) -> Self { Self::DoubleTapGesture(e) } } + impl From for WindowEvent { fn from(e: PanGesture) -> Self { Self::PanGesture(e) } } + impl From for WindowEvent { fn from(e: TouchInput) -> Self { Self::TouchInput(e) } } + impl From for WindowEvent { fn from(e: KeyboardInput) -> Self { Self::KeyboardInput(e) } } + impl From for WindowEvent { fn from(e: KeyboardFocusLost) -> Self { Self::KeyboardFocusLost(e) diff --git a/examples/3d/meshlet.rs b/examples/3d/meshlet.rs index 0bab7d7501..88678b90ac 100644 --- a/examples/3d/meshlet.rs +++ b/examples/3d/meshlet.rs @@ -128,4 +128,5 @@ fn setup( struct MeshletDebugMaterial { _dummy: (), } + impl Material for MeshletDebugMaterial {} diff --git a/examples/3d/parallax_mapping.rs b/examples/3d/parallax_mapping.rs index 47d83a4e76..b0dd376691 100644 --- a/examples/3d/parallax_mapping.rs +++ b/examples/3d/parallax_mapping.rs @@ -53,6 +53,7 @@ impl Default for CurrentMethod { CurrentMethod(ParallaxMappingMethod::Relief { max_steps: 4 }) } } + impl fmt::Display for CurrentMethod { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.0 { @@ -63,6 +64,7 @@ impl fmt::Display for CurrentMethod { } } } + impl CurrentMethod { fn next_method(&mut self) { use ParallaxMappingMethod::*; diff --git a/examples/animation/color_animation.rs b/examples/animation/color_animation.rs index df7a764bbf..e2076b96a7 100644 --- a/examples/animation/color_animation.rs +++ b/examples/animation/color_animation.rs @@ -4,10 +4,12 @@ use bevy::{math::VectorSpace, prelude::*}; // We define this trait so we can reuse the same code for multiple color types that may be implemented using curves. trait CurveColor: VectorSpace + Into + Send + Sync + 'static {} + impl + Into + Send + Sync + 'static> CurveColor for T {} // We define this trait so we can reuse the same code for multiple color types that may be implemented using mixing. trait MixedColor: Mix + Into + Send + Sync + 'static {} + impl + Send + Sync + 'static> MixedColor for T {} #[derive(Debug, Component)] diff --git a/examples/app/log_layers_ecs.rs b/examples/app/log_layers_ecs.rs index 1ee988b7cf..55e57081ff 100644 --- a/examples/app/log_layers_ecs.rs +++ b/examples/app/log_layers_ecs.rs @@ -63,6 +63,7 @@ fn transfer_log_events( struct CaptureLayer { sender: mpsc::Sender, } + impl Layer for CaptureLayer { fn on_event( &self, diff --git a/examples/shader/custom_render_phase.rs b/examples/shader/custom_render_phase.rs index 8bbf57d73c..0f834e893a 100644 --- a/examples/shader/custom_render_phase.rs +++ b/examples/shader/custom_render_phase.rs @@ -165,6 +165,7 @@ struct StencilPipeline { /// This isn't required, it's only done like this for simplicity. shader_handle: Handle, } + impl FromWorld for StencilPipeline { fn from_world(world: &mut World) -> Self { Self { @@ -382,6 +383,7 @@ impl GetBatchData for StencilPipeline { Some((mesh_uniform, None)) } } + impl GetFullBatchData for StencilPipeline { type BufferInputData = MeshInputUniform; diff --git a/examples/shader/gpu_readback.rs b/examples/shader/gpu_readback.rs index fb8a583a07..4db5795c89 100644 --- a/examples/shader/gpu_readback.rs +++ b/examples/shader/gpu_readback.rs @@ -193,6 +193,7 @@ struct ComputeNodeLabel; /// The node that will execute the compute shader #[derive(Default)] struct ComputeNode {} + impl render_graph::Node for ComputeNode { fn run( &self, diff --git a/examples/shader/specialized_mesh_pipeline.rs b/examples/shader/specialized_mesh_pipeline.rs index a2cfd11b34..9a7a3fce96 100644 --- a/examples/shader/specialized_mesh_pipeline.rs +++ b/examples/shader/specialized_mesh_pipeline.rs @@ -171,6 +171,7 @@ struct CustomMeshPipeline { /// This isn't required, it's only done like this for simplicity. shader_handle: Handle, } + impl FromWorld for CustomMeshPipeline { fn from_world(world: &mut World) -> Self { // Load the shader diff --git a/examples/tools/gamepad_viewer.rs b/examples/tools/gamepad_viewer.rs index fc4d2d4c40..73cd446809 100644 --- a/examples/tools/gamepad_viewer.rs +++ b/examples/tools/gamepad_viewer.rs @@ -48,6 +48,7 @@ struct ButtonMaterials { normal: MeshMaterial2d, active: MeshMaterial2d, } + impl FromWorld for ButtonMaterials { fn from_world(world: &mut World) -> Self { Self { @@ -63,6 +64,7 @@ struct ButtonMeshes { start_pause: Mesh2d, trigger: Mesh2d, } + impl FromWorld for ButtonMeshes { fn from_world(world: &mut World) -> Self { Self { diff --git a/examples/tools/scene_viewer/animation_plugin.rs b/examples/tools/scene_viewer/animation_plugin.rs index 42d3cef17e..65baff04d9 100644 --- a/examples/tools/scene_viewer/animation_plugin.rs +++ b/examples/tools/scene_viewer/animation_plugin.rs @@ -11,6 +11,7 @@ struct Clips { nodes: Vec, current: usize, } + impl Clips { fn new(clips: Vec) -> Self { Clips { diff --git a/examples/tools/scene_viewer/morph_viewer_plugin.rs b/examples/tools/scene_viewer/morph_viewer_plugin.rs index 90cb7ef838..efab95e1bf 100644 --- a/examples/tools/scene_viewer/morph_viewer_plugin.rs +++ b/examples/tools/scene_viewer/morph_viewer_plugin.rs @@ -80,6 +80,7 @@ enum WeightChange { Increase, Decrease, } + impl WeightChange { fn reverse(&mut self) { *self = match *self { @@ -112,6 +113,7 @@ struct Target { weight: f32, change_dir: WeightChange, } + impl fmt::Display for Target { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match (self.name.as_ref(), self.entity_name.as_ref()) { @@ -123,6 +125,7 @@ impl fmt::Display for Target { write!(f, ": {}", self.weight) } } + impl Target { fn text_span(&self, key: &str, style: TextFont) -> (TextSpan, TextFont) { (TextSpan::new(format!("[{key}] {self}\n")), style) @@ -160,6 +163,7 @@ struct MorphKey { modifiers: &'static [KeyCode], key: KeyCode, } + impl MorphKey { const fn new(name: &'static str, modifiers: &'static [KeyCode], key: KeyCode) -> Self { MorphKey { diff --git a/examples/ui/box_shadow.rs b/examples/ui/box_shadow.rs index 10030dfe42..ee00656e7f 100644 --- a/examples/ui/box_shadow.rs +++ b/examples/ui/box_shadow.rs @@ -94,6 +94,7 @@ enum SettingType { Shape, Samples, } + impl SettingType { fn label(&self) -> &str { match self {