@@ -2607,14 +2607,14 @@ impl<'w> EntityWorldMut<'w> {
2607
2607
/// # Panics
2608
2608
///
2609
2609
/// If the entity has been despawned while this `EntityWorldMut` is still alive.
2610
- pub fn entry < ' a , T : Component > ( & ' a mut self ) -> Entry < ' w , ' a , T > {
2610
+ pub fn entry < ' a , T : Component > ( & ' a mut self ) -> ComponentEntry < ' w , ' a , T > {
2611
2611
if self . contains :: < T > ( ) {
2612
- Entry :: Occupied ( OccupiedEntry {
2612
+ ComponentEntry :: Occupied ( OccupiedComponentEntry {
2613
2613
entity_world : self ,
2614
2614
_marker : PhantomData ,
2615
2615
} )
2616
2616
} else {
2617
- Entry :: Vacant ( VacantEntry {
2617
+ ComponentEntry :: Vacant ( VacantComponentEntry {
2618
2618
entity_world : self ,
2619
2619
_marker : PhantomData ,
2620
2620
} )
@@ -2857,14 +2857,14 @@ impl<'w> EntityWorldMut<'w> {
2857
2857
/// This `enum` can only be constructed from the [`entry`] method on [`EntityWorldMut`].
2858
2858
///
2859
2859
/// [`entry`]: EntityWorldMut::entry
2860
- pub enum Entry < ' w , ' a , T : Component > {
2860
+ pub enum ComponentEntry < ' w , ' a , T : Component > {
2861
2861
/// An occupied entry.
2862
- Occupied ( OccupiedEntry < ' w , ' a , T > ) ,
2862
+ Occupied ( OccupiedComponentEntry < ' w , ' a , T > ) ,
2863
2863
/// A vacant entry.
2864
- Vacant ( VacantEntry < ' w , ' a , T > ) ,
2864
+ Vacant ( VacantComponentEntry < ' w , ' a , T > ) ,
2865
2865
}
2866
2866
2867
- impl < ' w , ' a , T : Component < Mutability = Mutable > > Entry < ' w , ' a , T > {
2867
+ impl < ' w , ' a , T : Component < Mutability = Mutable > > ComponentEntry < ' w , ' a , T > {
2868
2868
/// Provides in-place mutable access to an occupied entry.
2869
2869
///
2870
2870
/// # Examples
@@ -2883,17 +2883,17 @@ impl<'w, 'a, T: Component<Mutability = Mutable>> Entry<'w, 'a, T> {
2883
2883
#[ inline]
2884
2884
pub fn and_modify < F : FnOnce ( Mut < ' _ , T > ) > ( self , f : F ) -> Self {
2885
2885
match self {
2886
- Entry :: Occupied ( mut entry) => {
2886
+ ComponentEntry :: Occupied ( mut entry) => {
2887
2887
f ( entry. get_mut ( ) ) ;
2888
- Entry :: Occupied ( entry)
2888
+ ComponentEntry :: Occupied ( entry)
2889
2889
}
2890
- Entry :: Vacant ( entry) => Entry :: Vacant ( entry) ,
2890
+ ComponentEntry :: Vacant ( entry) => ComponentEntry :: Vacant ( entry) ,
2891
2891
}
2892
2892
}
2893
2893
}
2894
2894
2895
- impl < ' w , ' a , T : Component > Entry < ' w , ' a , T > {
2896
- /// Replaces the component of the entry, and returns an [`OccupiedEntry `].
2895
+ impl < ' w , ' a , T : Component > ComponentEntry < ' w , ' a , T > {
2896
+ /// Replaces the component of the entry, and returns an [`OccupiedComponentEntry `].
2897
2897
///
2898
2898
/// # Examples
2899
2899
///
@@ -2912,13 +2912,13 @@ impl<'w, 'a, T: Component> Entry<'w, 'a, T> {
2912
2912
/// assert_eq!(entry.get(), &Comp(2));
2913
2913
/// ```
2914
2914
#[ inline]
2915
- pub fn insert_entry ( self , component : T ) -> OccupiedEntry < ' w , ' a , T > {
2915
+ pub fn insert_entry ( self , component : T ) -> OccupiedComponentEntry < ' w , ' a , T > {
2916
2916
match self {
2917
- Entry :: Occupied ( mut entry) => {
2917
+ ComponentEntry :: Occupied ( mut entry) => {
2918
2918
entry. insert ( component) ;
2919
2919
entry
2920
2920
}
2921
- Entry :: Vacant ( entry) => entry. insert ( component) ,
2921
+ ComponentEntry :: Vacant ( entry) => entry. insert ( component) ,
2922
2922
}
2923
2923
}
2924
2924
@@ -2944,10 +2944,10 @@ impl<'w, 'a, T: Component> Entry<'w, 'a, T> {
2944
2944
/// assert_eq!(world.query::<&Comp>().single(&world).unwrap().0, 8);
2945
2945
/// ```
2946
2946
#[ inline]
2947
- pub fn or_insert ( self , default : T ) -> OccupiedEntry < ' w , ' a , T > {
2947
+ pub fn or_insert ( self , default : T ) -> OccupiedComponentEntry < ' w , ' a , T > {
2948
2948
match self {
2949
- Entry :: Occupied ( entry) => entry,
2950
- Entry :: Vacant ( entry) => entry. insert ( default) ,
2949
+ ComponentEntry :: Occupied ( entry) => entry,
2950
+ ComponentEntry :: Vacant ( entry) => entry. insert ( default) ,
2951
2951
}
2952
2952
}
2953
2953
@@ -2968,15 +2968,15 @@ impl<'w, 'a, T: Component> Entry<'w, 'a, T> {
2968
2968
/// assert_eq!(world.query::<&Comp>().single(&world).unwrap().0, 4);
2969
2969
/// ```
2970
2970
#[ inline]
2971
- pub fn or_insert_with < F : FnOnce ( ) -> T > ( self , default : F ) -> OccupiedEntry < ' w , ' a , T > {
2971
+ pub fn or_insert_with < F : FnOnce ( ) -> T > ( self , default : F ) -> OccupiedComponentEntry < ' w , ' a , T > {
2972
2972
match self {
2973
- Entry :: Occupied ( entry) => entry,
2974
- Entry :: Vacant ( entry) => entry. insert ( default ( ) ) ,
2973
+ ComponentEntry :: Occupied ( entry) => entry,
2974
+ ComponentEntry :: Vacant ( entry) => entry. insert ( default ( ) ) ,
2975
2975
}
2976
2976
}
2977
2977
}
2978
2978
2979
- impl < ' w , ' a , T : Component + Default > Entry < ' w , ' a , T > {
2979
+ impl < ' w , ' a , T : Component + Default > ComponentEntry < ' w , ' a , T > {
2980
2980
/// Ensures the entry has this component by inserting the default value if empty, and
2981
2981
/// returns a mutable reference to this component in the entry.
2982
2982
///
@@ -2994,42 +2994,42 @@ impl<'w, 'a, T: Component + Default> Entry<'w, 'a, T> {
2994
2994
/// assert_eq!(world.query::<&Comp>().single(&world).unwrap().0, 0);
2995
2995
/// ```
2996
2996
#[ inline]
2997
- pub fn or_default ( self ) -> OccupiedEntry < ' w , ' a , T > {
2997
+ pub fn or_default ( self ) -> OccupiedComponentEntry < ' w , ' a , T > {
2998
2998
match self {
2999
- Entry :: Occupied ( entry) => entry,
3000
- Entry :: Vacant ( entry) => entry. insert ( Default :: default ( ) ) ,
2999
+ ComponentEntry :: Occupied ( entry) => entry,
3000
+ ComponentEntry :: Vacant ( entry) => entry. insert ( Default :: default ( ) ) ,
3001
3001
}
3002
3002
}
3003
3003
}
3004
3004
3005
- /// A view into an occupied entry in a [`EntityWorldMut`]. It is part of the [`Entry `] enum.
3005
+ /// A view into an occupied entry in a [`EntityWorldMut`]. It is part of the [`OccupiedComponentEntry `] enum.
3006
3006
///
3007
3007
/// The contained entity must have the component type parameter if we have this struct.
3008
- pub struct OccupiedEntry < ' w , ' a , T : Component > {
3008
+ pub struct OccupiedComponentEntry < ' w , ' a , T : Component > {
3009
3009
entity_world : & ' a mut EntityWorldMut < ' w > ,
3010
3010
_marker : PhantomData < T > ,
3011
3011
}
3012
3012
3013
- impl < ' w , ' a , T : Component > OccupiedEntry < ' w , ' a , T > {
3013
+ impl < ' w , ' a , T : Component > OccupiedComponentEntry < ' w , ' a , T > {
3014
3014
/// Gets a reference to the component in the entry.
3015
3015
///
3016
3016
/// # Examples
3017
3017
///
3018
3018
/// ```
3019
- /// # use bevy_ecs::{prelude::*, world::Entry };
3019
+ /// # use bevy_ecs::{prelude::*, world::ComponentEntry };
3020
3020
/// #[derive(Component, Default, Clone, Copy, Debug, PartialEq)]
3021
3021
/// struct Comp(u32);
3022
3022
///
3023
3023
/// # let mut world = World::new();
3024
3024
/// let mut entity = world.spawn(Comp(5));
3025
3025
///
3026
- /// if let Entry ::Occupied(o) = entity.entry::<Comp>() {
3026
+ /// if let ComponentEntry ::Occupied(o) = entity.entry::<Comp>() {
3027
3027
/// assert_eq!(o.get().0, 5);
3028
3028
/// }
3029
3029
/// ```
3030
3030
#[ inline]
3031
3031
pub fn get ( & self ) -> & T {
3032
- // This shouldn't panic because if we have an OccupiedEntry the component must exist.
3032
+ // This shouldn't panic because if we have an OccupiedComponentEntry the component must exist.
3033
3033
self . entity_world . get :: < T > ( ) . unwrap ( )
3034
3034
}
3035
3035
@@ -3038,14 +3038,14 @@ impl<'w, 'a, T: Component> OccupiedEntry<'w, 'a, T> {
3038
3038
/// # Examples
3039
3039
///
3040
3040
/// ```
3041
- /// # use bevy_ecs::{prelude::*, world::Entry };
3041
+ /// # use bevy_ecs::{prelude::*, world::ComponentEntry };
3042
3042
/// #[derive(Component, Default, Clone, Copy, Debug, PartialEq)]
3043
3043
/// struct Comp(u32);
3044
3044
///
3045
3045
/// # let mut world = World::new();
3046
3046
/// let mut entity = world.spawn(Comp(5));
3047
3047
///
3048
- /// if let Entry ::Occupied(mut o) = entity.entry::<Comp>() {
3048
+ /// if let ComponentEntry ::Occupied(mut o) = entity.entry::<Comp>() {
3049
3049
/// o.insert(Comp(10));
3050
3050
/// }
3051
3051
///
@@ -3061,45 +3061,45 @@ impl<'w, 'a, T: Component> OccupiedEntry<'w, 'a, T> {
3061
3061
/// # Examples
3062
3062
///
3063
3063
/// ```
3064
- /// # use bevy_ecs::{prelude::*, world::Entry };
3064
+ /// # use bevy_ecs::{prelude::*, world::ComponentEntry };
3065
3065
/// #[derive(Component, Default, Clone, Copy, Debug, PartialEq)]
3066
3066
/// struct Comp(u32);
3067
3067
///
3068
3068
/// # let mut world = World::new();
3069
3069
/// let mut entity = world.spawn(Comp(5));
3070
3070
///
3071
- /// if let Entry ::Occupied(o) = entity.entry::<Comp>() {
3071
+ /// if let ComponentEntry ::Occupied(o) = entity.entry::<Comp>() {
3072
3072
/// assert_eq!(o.take(), Comp(5));
3073
3073
/// }
3074
3074
///
3075
3075
/// assert_eq!(world.query::<&Comp>().iter(&world).len(), 0);
3076
3076
/// ```
3077
3077
#[ inline]
3078
3078
pub fn take ( self ) -> T {
3079
- // This shouldn't panic because if we have an OccupiedEntry the component must exist.
3079
+ // This shouldn't panic because if we have an OccupiedComponentEntry the component must exist.
3080
3080
self . entity_world . take ( ) . unwrap ( )
3081
3081
}
3082
3082
}
3083
3083
3084
- impl < ' w , ' a , T : Component < Mutability = Mutable > > OccupiedEntry < ' w , ' a , T > {
3084
+ impl < ' w , ' a , T : Component < Mutability = Mutable > > OccupiedComponentEntry < ' w , ' a , T > {
3085
3085
/// Gets a mutable reference to the component in the entry.
3086
3086
///
3087
- /// If you need a reference to the `OccupiedEntry` which may outlive the destruction of
3088
- /// the `Entry` value, see [`into_mut`].
3087
+ /// If you need a reference to the [`OccupiedComponentEntry`] which may outlive the destruction of
3088
+ /// the [`OccupiedComponentEntry`] value, see [`into_mut`].
3089
3089
///
3090
3090
/// [`into_mut`]: Self::into_mut
3091
3091
///
3092
3092
/// # Examples
3093
3093
///
3094
3094
/// ```
3095
- /// # use bevy_ecs::{prelude::*, world::Entry };
3095
+ /// # use bevy_ecs::{prelude::*, world::ComponentEntry };
3096
3096
/// #[derive(Component, Default, Clone, Copy, Debug, PartialEq)]
3097
3097
/// struct Comp(u32);
3098
3098
///
3099
3099
/// # let mut world = World::new();
3100
3100
/// let mut entity = world.spawn(Comp(5));
3101
3101
///
3102
- /// if let Entry ::Occupied(mut o) = entity.entry::<Comp>() {
3102
+ /// if let ComponentEntry ::Occupied(mut o) = entity.entry::<Comp>() {
3103
3103
/// o.get_mut().0 += 10;
3104
3104
/// assert_eq!(o.get().0, 15);
3105
3105
///
@@ -3111,69 +3111,69 @@ impl<'w, 'a, T: Component<Mutability = Mutable>> OccupiedEntry<'w, 'a, T> {
3111
3111
/// ```
3112
3112
#[ inline]
3113
3113
pub fn get_mut ( & mut self ) -> Mut < ' _ , T > {
3114
- // This shouldn't panic because if we have an OccupiedEntry the component must exist.
3114
+ // This shouldn't panic because if we have an OccupiedComponentEntry the component must exist.
3115
3115
self . entity_world . get_mut :: < T > ( ) . unwrap ( )
3116
3116
}
3117
3117
3118
- /// Converts the `OccupiedEntry` into a mutable reference to the value in the entry with
3118
+ /// Converts the [`OccupiedComponentEntry`] into a mutable reference to the value in the entry with
3119
3119
/// a lifetime bound to the `EntityWorldMut`.
3120
3120
///
3121
- /// If you need multiple references to the `OccupiedEntry` , see [`get_mut`].
3121
+ /// If you need multiple references to the [`OccupiedComponentEntry`] , see [`get_mut`].
3122
3122
///
3123
3123
/// [`get_mut`]: Self::get_mut
3124
3124
///
3125
3125
/// # Examples
3126
3126
///
3127
3127
/// ```
3128
- /// # use bevy_ecs::{prelude::*, world::Entry };
3128
+ /// # use bevy_ecs::{prelude::*, world::ComponentEntry };
3129
3129
/// #[derive(Component, Default, Clone, Copy, Debug, PartialEq)]
3130
3130
/// struct Comp(u32);
3131
3131
///
3132
3132
/// # let mut world = World::new();
3133
3133
/// let mut entity = world.spawn(Comp(5));
3134
3134
///
3135
- /// if let Entry ::Occupied(o) = entity.entry::<Comp>() {
3135
+ /// if let ComponentEntry ::Occupied(o) = entity.entry::<Comp>() {
3136
3136
/// o.into_mut().0 += 10;
3137
3137
/// }
3138
3138
///
3139
3139
/// assert_eq!(world.query::<&Comp>().single(&world).unwrap().0, 15);
3140
3140
/// ```
3141
3141
#[ inline]
3142
3142
pub fn into_mut ( self ) -> Mut < ' a , T > {
3143
- // This shouldn't panic because if we have an OccupiedEntry the component must exist.
3143
+ // This shouldn't panic because if we have an OccupiedComponentEntry the component must exist.
3144
3144
self . entity_world . get_mut ( ) . unwrap ( )
3145
3145
}
3146
3146
}
3147
3147
3148
- /// A view into a vacant entry in a [`EntityWorldMut`]. It is part of the [`Entry `] enum.
3149
- pub struct VacantEntry < ' w , ' a , T : Component > {
3148
+ /// A view into a vacant entry in a [`EntityWorldMut`]. It is part of the [`ComponentEntry `] enum.
3149
+ pub struct VacantComponentEntry < ' w , ' a , T : Component > {
3150
3150
entity_world : & ' a mut EntityWorldMut < ' w > ,
3151
3151
_marker : PhantomData < T > ,
3152
3152
}
3153
3153
3154
- impl < ' w , ' a , T : Component > VacantEntry < ' w , ' a , T > {
3155
- /// Inserts the component into the `VacantEntry` and returns an `OccupiedEntry` .
3154
+ impl < ' w , ' a , T : Component > VacantComponentEntry < ' w , ' a , T > {
3155
+ /// Inserts the component into the [`VacantComponentEntry`] and returns an [`OccupiedComponentEntry`] .
3156
3156
///
3157
3157
/// # Examples
3158
3158
///
3159
3159
/// ```
3160
- /// # use bevy_ecs::{prelude::*, world::Entry };
3160
+ /// # use bevy_ecs::{prelude::*, world::ComponentEntry };
3161
3161
/// #[derive(Component, Default, Clone, Copy, Debug, PartialEq)]
3162
3162
/// struct Comp(u32);
3163
3163
///
3164
3164
/// # let mut world = World::new();
3165
3165
/// let mut entity = world.spawn_empty();
3166
3166
///
3167
- /// if let Entry ::Vacant(v) = entity.entry::<Comp>() {
3167
+ /// if let ComponentEntry ::Vacant(v) = entity.entry::<Comp>() {
3168
3168
/// v.insert(Comp(10));
3169
3169
/// }
3170
3170
///
3171
3171
/// assert_eq!(world.query::<&Comp>().single(&world).unwrap().0, 10);
3172
3172
/// ```
3173
3173
#[ inline]
3174
- pub fn insert ( self , component : T ) -> OccupiedEntry < ' w , ' a , T > {
3174
+ pub fn insert ( self , component : T ) -> OccupiedComponentEntry < ' w , ' a , T > {
3175
3175
self . entity_world . insert ( component) ;
3176
- OccupiedEntry {
3176
+ OccupiedComponentEntry {
3177
3177
entity_world : self . entity_world ,
3178
3178
_marker : PhantomData ,
3179
3179
}
@@ -3184,7 +3184,7 @@ impl<'w, 'a, T: Component> VacantEntry<'w, 'a, T> {
3184
3184
///
3185
3185
/// To define the access when used as a [`QueryData`](crate::query::QueryData),
3186
3186
/// use a [`QueryBuilder`](crate::query::QueryBuilder) or [`QueryParamBuilder`](crate::system::QueryParamBuilder).
3187
- /// The `FilteredEntityRef` must be the entire `QueryData`, and not nested inside a tuple with other data.
3187
+ /// The [ `FilteredEntityRef`] must be the entire [ `QueryData`](crate::query::QueryData) , and not nested inside a tuple with other data.
3188
3188
///
3189
3189
/// ```
3190
3190
/// # use bevy_ecs::{prelude::*, world::FilteredEntityRef};
0 commit comments