Skip to content

Commit cd07ae1

Browse files
committed
Move map-like exports to crate::map
1 parent 59c9ebf commit cd07ae1

File tree

11 files changed

+36
-27
lines changed

11 files changed

+36
-27
lines changed

benches/benches/bevy_reflect/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use core::{fmt::Write, hint::black_box, iter, time::Duration};
22

33
use benches::bench;
44
use bevy_platform::collections::HashMap;
5-
use bevy_reflect::{DynamicMap, Map};
5+
use bevy_reflect::map::{DynamicMap, Map};
66
use criterion::{
77
criterion_group, measurement::Measurement, AxisScale, BatchSize, BenchmarkGroup, BenchmarkId,
88
Criterion, PlotConfiguration, Throughput,

crates/bevy_animation/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ impl<'a> Iterator for TriggeredEventsIter<'a> {
15221522
#[cfg(test)]
15231523
mod tests {
15241524
use crate as bevy_animation;
1525-
use bevy_reflect::{DynamicMap, Map};
1525+
use bevy_reflect::map::{DynamicMap, Map};
15261526

15271527
use super::*;
15281528

crates/bevy_reflect/src/impls/indexmap.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use crate::{
55
};
66
use bevy_platform::prelude::{Box, Vec};
77
use bevy_reflect::{
8-
DynamicMap, Map, MapInfo, MaybeTyped, ReflectFromReflect, ReflectKind, TypeRegistry, Typed,
8+
map::{DynamicMap, Map, MapInfo},
9+
MaybeTyped, ReflectFromReflect, ReflectKind, TypeRegistry, Typed,
910
};
1011
use bevy_reflect_derive::impl_type_path;
1112
use core::{any::Any, hash::BuildHasher, hash::Hash};
@@ -140,11 +141,11 @@ where
140141
}
141142

142143
fn apply(&mut self, value: &dyn PartialReflect) {
143-
crate::map_apply(self, value);
144+
crate::map::map_apply(self, value);
144145
}
145146

146147
fn try_apply(&mut self, value: &dyn PartialReflect) -> Result<(), crate::ApplyError> {
147-
crate::map_try_apply(self, value)
148+
crate::map::map_try_apply(self, value)
148149
}
149150

150151
fn reflect_kind(&self) -> ReflectKind {
@@ -175,7 +176,7 @@ where
175176
}
176177

177178
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
178-
crate::map_partial_eq(self, value)
179+
crate::map::map_partial_eq(self, value)
179180
}
180181
}
181182

crates/bevy_reflect/src/kind.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ use thiserror::Error;
44
#[cfg(feature = "functions")]
55
use crate::func::Function;
66
use crate::{
7-
array::Array, enums::Enum, list::List, Map, PartialReflect, Set, Struct, Tuple, TupleStruct,
7+
array::Array, enums::Enum, list::List, map::Map, PartialReflect, Set, Struct, Tuple,
8+
TupleStruct,
89
};
910

1011
/// An enumeration of the "kinds" of a reflected type.

crates/bevy_reflect/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,10 +543,12 @@
543543
//! [`'static` lifetime]: https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html#trait-bound
544544
//! [`Array`]: crate::array::Array
545545
//! [`List`]: crate::list::List
546+
//! [`Map`]: crate::map::Map
546547
//! [`Enum`]: crate::enums::Enum
547548
//! [`Function`]: crate::func::Function
548549
//! [`DynamicArray`]: crate::array::DynamicArray
549550
//! [`DynamicList`]: crate::list::DynamicList
551+
//! [`DynamicMap`]: crate::map::DynamicMap
550552
//! [`DynamicEnum`]: crate::enums::DynamicEnum
551553
//! [derive macro documentation]: derive@crate::Reflect
552554
//! [deriving `Reflect`]: derive@crate::Reflect
@@ -593,7 +595,7 @@ pub mod func;
593595
mod is;
594596
mod kind;
595597
pub mod list;
596-
mod map;
598+
pub mod map;
597599
mod path;
598600
mod reflect;
599601
mod reflectable;
@@ -665,7 +667,6 @@ pub use from_reflect::*;
665667
pub use generics::*;
666668
pub use is::*;
667669
pub use kind::*;
668-
pub use map::*;
669670
pub use path::*;
670671
pub use reflect::*;
671672
pub use reflectable::*;
@@ -687,7 +688,7 @@ pub use erased_serde;
687688
#[doc(hidden)]
688689
pub mod __macro_exports {
689690
use crate::{
690-
array::DynamicArray, enums::DynamicEnum, list::DynamicList, DynamicMap, DynamicStruct,
691+
array::DynamicArray, enums::DynamicEnum, list::DynamicList, map::DynamicMap, DynamicStruct,
691692
DynamicTuple, DynamicTupleStruct, GetTypeRegistration, TypeRegistry,
692693
};
693694

@@ -867,7 +868,7 @@ mod tests {
867868
};
868869
use static_assertions::{assert_impl_all, assert_not_impl_all};
869870

870-
use super::{array::*, enums::*, list::*, prelude::*, *};
871+
use super::{array::*, enums::*, list::*, map::*, prelude::*, *};
871872
use crate::{
872873
serde::{ReflectDeserializer, ReflectSerializer},
873874
utility::GenericTypePathCell,

crates/bevy_reflect/src/map.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! Traits and types used to power [map-like] operations via reflection.
2+
//!
3+
//! [map-like]: https://doc.rust-lang.org/book/ch08-03-hash-maps.html
14
use core::fmt::{Debug, Formatter};
25

36
use bevy_platform::collections::HashTable;
@@ -29,7 +32,7 @@ use alloc::{boxed::Box, format, vec::Vec};
2932
/// # Example
3033
///
3134
/// ```
32-
/// use bevy_reflect::{PartialReflect, Reflect, Map};
35+
/// use bevy_reflect::{PartialReflect, Reflect, map::Map};
3336
/// use std::collections::HashMap;
3437
///
3538
///

crates/bevy_reflect/src/reflect.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::{
2-
array::array_debug, enums::enum_debug, list::list_debug, map_debug, set_debug, struct_debug,
3-
tuple_debug, tuple_struct_debug, DynamicTypePath, DynamicTyped, OpaqueInfo, ReflectCloneError,
4-
ReflectKind, ReflectKindMismatchError, ReflectMut, ReflectOwned, ReflectRef, TypeInfo,
5-
TypePath, Typed,
2+
array::array_debug, enums::enum_debug, list::list_debug, map::map_debug, set_debug,
3+
struct_debug, tuple_debug, tuple_struct_debug, DynamicTypePath, DynamicTyped, OpaqueInfo,
4+
ReflectCloneError, ReflectKind, ReflectKindMismatchError, ReflectMut, ReflectOwned, ReflectRef,
5+
TypeInfo, TypePath, Typed,
66
};
77
use alloc::borrow::Cow;
88
use alloc::boxed::Box;
@@ -188,10 +188,10 @@ where
188188
/// [`Enum`]: crate::enums::Enum
189189
/// [`List`]: crate::list::List
190190
/// [`Array`]: crate::array::Array
191-
/// [`Map`]: crate::Map
191+
/// [`Map`]: crate::map::Map
192192
/// [`Set`]: crate::Set
193193
/// [`list_apply`]: crate::list::list_apply
194-
/// [`map_apply`]: crate::map_apply
194+
/// [`map_apply`]: crate::map::map_apply
195195
/// [`set_apply`]: crate::set_apply
196196
///
197197
/// # Panics
@@ -353,7 +353,7 @@ where
353353
/// where `type_path` is the [type path] of the underlying type.
354354
///
355355
/// [`List`]: crate::list::List
356-
/// [`Map`]: crate::Map
356+
/// [`Map`]: crate::map::Map
357357
/// [type path]: TypePath::type_path
358358
fn debug(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
359359
match self.reflect_ref() {

crates/bevy_reflect/src/serde/de/maps.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::{
2+
map::{DynamicMap, Map, MapInfo},
23
serde::{de::registration_utils::try_get_registration, TypedReflectDeserializer},
3-
DynamicMap, Map, MapInfo, TypeRegistry,
4+
TypeRegistry,
45
};
56
use core::{fmt, fmt::Formatter};
67
use serde::de::{MapAccess, Visitor};
@@ -9,7 +10,7 @@ use super::ReflectDeserializerProcessor;
910

1011
/// A [`Visitor`] for deserializing [`Map`] values.
1112
///
12-
/// [`Map`]: crate::Map
13+
/// [`Map`]: crate::map::Map
1314
pub(super) struct MapVisitor<'a, P> {
1415
pub map_info: &'static MapInfo,
1516
pub registry: &'a TypeRegistry,

crates/bevy_reflect/src/serde/ser/maps.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{serde::TypedReflectSerializer, Map, TypeRegistry};
1+
use crate::{map::Map, serde::TypedReflectSerializer, TypeRegistry};
22
use serde::{ser::SerializeMap, Serialize};
33

44
use super::ReflectSerializerProcessor;

crates/bevy_reflect/src/type_info.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ use crate::{
22
array::{ArrayInfo, DynamicArray},
33
enums::{DynamicEnum, EnumInfo},
44
list::{DynamicList, ListInfo},
5-
DynamicMap, DynamicStruct, DynamicTuple, DynamicTupleStruct, Generics, MapInfo, PartialReflect,
6-
Reflect, ReflectKind, SetInfo, StructInfo, TupleInfo, TupleStructInfo, TypePath, TypePathTable,
5+
map::{DynamicMap, MapInfo},
6+
DynamicStruct, DynamicTuple, DynamicTupleStruct, Generics, PartialReflect, Reflect,
7+
ReflectKind, SetInfo, StructInfo, TupleInfo, TupleStructInfo, TypePath, TypePathTable,
78
};
89
use core::{
910
any::{Any, TypeId},
@@ -225,7 +226,7 @@ pub enum TypeInfo {
225226
Array(ArrayInfo),
226227
/// Type information for a [map-like] type.
227228
///
228-
/// [map-like]: crate::Map
229+
/// [map-like]: crate::map::Map
229230
Map(MapInfo),
230231
/// Type information for a [set-like] type.
231232
///

0 commit comments

Comments
 (0)