Skip to content

Commit 59c9ebf

Browse files
committed
Move list-like exports to crate::list
1 parent 75380b8 commit 59c9ebf

File tree

16 files changed

+50
-43
lines changed

16 files changed

+50
-43
lines changed

benches/benches/bevy_reflect/list.rs

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

33
use benches::bench;
4-
use bevy_reflect::{DynamicList, List};
4+
use bevy_reflect::list::{DynamicList, List};
55
use criterion::{
66
criterion_group, measurement::Measurement, AxisScale, BatchSize, BenchmarkGroup, BenchmarkId,
77
Criterion, PlotConfiguration, Throughput,

crates/bevy_reflect/src/array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use core::{
4545
///
4646
/// [array-like]: https://doc.rust-lang.org/book/ch03-02-data-types.html#the-array-type
4747
/// [reflection]: crate
48-
/// [`List`]: crate::List
48+
/// [`List`]: crate::list::List
4949
/// [type-erasing]: https://doc.rust-lang.org/book/ch17-02-trait-objects.html
5050
/// [`GetTypeRegistration`]: crate::GetTypeRegistration
5151
/// [limitation]: https://github.com/serde-rs/serde/issues/1937
@@ -162,7 +162,7 @@ impl ArrayInfo {
162162
/// This isn't to say that a [`DynamicArray`] is immutable— its items
163163
/// can be mutated— just that the _number_ of items cannot change.
164164
///
165-
/// [`DynamicList`]: crate::DynamicList
165+
/// [`DynamicList`]: crate::list::DynamicList
166166
#[derive(Debug)]
167167
pub struct DynamicArray {
168168
pub(crate) represented_type: Option<&'static TypeInfo>,

crates/bevy_reflect/src/from_reflect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub trait FromReflect: Reflect + Sized {
3939
///
4040
/// [`from_reflect`]: Self::from_reflect
4141
/// [`DynamicStruct`]: crate::DynamicStruct
42-
/// [`DynamicList`]: crate::DynamicList
42+
/// [`DynamicList`]: crate::list::DynamicList
4343
fn take_from_reflect(
4444
reflect: Box<dyn PartialReflect>,
4545
) -> Result<Self, Box<dyn PartialReflect>> {

crates/bevy_reflect/src/impls/alloc/borrow.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,19 +245,19 @@ impl<T: FromReflect + MaybeTyped + Clone + TypePath + GetTypeRegistration> Parti
245245
}
246246

247247
fn reflect_hash(&self) -> Option<u64> {
248-
crate::list_hash(self)
248+
crate::list::list_hash(self)
249249
}
250250

251251
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
252-
crate::list_partial_eq(self, value)
252+
crate::list::list_partial_eq(self, value)
253253
}
254254

255255
fn apply(&mut self, value: &dyn PartialReflect) {
256-
crate::list_apply(self, value);
256+
crate::list::list_apply(self, value);
257257
}
258258

259259
fn try_apply(&mut self, value: &dyn PartialReflect) -> Result<(), ApplyError> {
260-
crate::list_try_apply(self, value)
260+
crate::list::list_try_apply(self, value)
261261
}
262262
}
263263

crates/bevy_reflect/src/impls/smallvec.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
use crate::{
2-
utility::GenericTypeInfoCell, ApplyError, FromReflect, FromType, Generics, GetTypeRegistration,
3-
List, ListInfo, ListIter, MaybeTyped, PartialReflect, Reflect, ReflectFromPtr, ReflectKind,
4-
ReflectMut, ReflectOwned, ReflectRef, TypeInfo, TypeParamInfo, TypePath, TypeRegistration,
5-
Typed,
2+
list::{List, ListInfo, ListIter},
3+
utility::GenericTypeInfoCell,
4+
ApplyError, FromReflect, FromType, Generics, GetTypeRegistration, MaybeTyped, PartialReflect,
5+
Reflect, ReflectFromPtr, ReflectKind, ReflectMut, ReflectOwned, ReflectRef, TypeInfo,
6+
TypeParamInfo, TypePath, TypeRegistration, Typed,
67
};
78
use alloc::{boxed::Box, vec::Vec};
89
use bevy_reflect::ReflectCloneError;
@@ -112,11 +113,11 @@ where
112113
}
113114

114115
fn apply(&mut self, value: &dyn PartialReflect) {
115-
crate::list_apply(self, value);
116+
crate::list::list_apply(self, value);
116117
}
117118

118119
fn try_apply(&mut self, value: &dyn PartialReflect) -> Result<(), ApplyError> {
119-
crate::list_try_apply(self, value)
120+
crate::list::list_try_apply(self, value)
120121
}
121122

122123
fn reflect_kind(&self) -> ReflectKind {
@@ -147,7 +148,7 @@ where
147148
}
148149

149150
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
150-
crate::list_partial_eq(self, value)
151+
crate::list::list_partial_eq(self, value)
151152
}
152153
}
153154

crates/bevy_reflect/src/kind.rs

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

1010
/// 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
@@ -542,9 +542,11 @@
542542
//! [derive macro]: derive@crate::Reflect
543543
//! [`'static` lifetime]: https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html#trait-bound
544544
//! [`Array`]: crate::array::Array
545+
//! [`List`]: crate::list::List
545546
//! [`Enum`]: crate::enums::Enum
546547
//! [`Function`]: crate::func::Function
547548
//! [`DynamicArray`]: crate::array::DynamicArray
549+
//! [`DynamicList`]: crate::list::DynamicList
548550
//! [`DynamicEnum`]: crate::enums::DynamicEnum
549551
//! [derive macro documentation]: derive@crate::Reflect
550552
//! [deriving `Reflect`]: derive@crate::Reflect
@@ -590,7 +592,7 @@ mod from_reflect;
590592
pub mod func;
591593
mod is;
592594
mod kind;
593-
mod list;
595+
pub mod list;
594596
mod map;
595597
mod path;
596598
mod reflect;
@@ -663,7 +665,6 @@ pub use from_reflect::*;
663665
pub use generics::*;
664666
pub use is::*;
665667
pub use kind::*;
666-
pub use list::*;
667668
pub use map::*;
668669
pub use path::*;
669670
pub use reflect::*;
@@ -686,7 +687,7 @@ pub use erased_serde;
686687
#[doc(hidden)]
687688
pub mod __macro_exports {
688689
use crate::{
689-
array::DynamicArray, enums::DynamicEnum, DynamicList, DynamicMap, DynamicStruct,
690+
array::DynamicArray, enums::DynamicEnum, list::DynamicList, DynamicMap, DynamicStruct,
690691
DynamicTuple, DynamicTupleStruct, GetTypeRegistration, TypeRegistry,
691692
};
692693

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

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

crates/bevy_reflect/src/list.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! Types and traits used to power [list-like] operations via reflection.
2+
//!
3+
//! [list-like]: https://doc.rust-lang.org/book/ch08-01-vectors.html
14
use alloc::{boxed::Box, vec::Vec};
25
use core::{
36
any::Any,
@@ -39,7 +42,7 @@ use crate::{
3942
/// # Example
4043
///
4144
/// ```
42-
/// use bevy_reflect::{PartialReflect, Reflect, List};
45+
/// use bevy_reflect::{PartialReflect, Reflect, list::List};
4346
///
4447
/// let foo: &mut dyn List = &mut vec![123_u32, 456_u32, 789_u32];
4548
/// assert_eq!(foo.len(), 3);

crates/bevy_reflect/src/path/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl<'a> ReflectPath<'a> for &'a str {
241241
/// [`Struct`]: crate::Struct
242242
/// [`Tuple`]: crate::Tuple
243243
/// [`TupleStruct`]: crate::TupleStruct
244-
/// [`List`]: crate::List
244+
/// [`List`]: crate::list::List
245245
/// [`Array`]: crate::array::Array
246246
/// [`Enum`]: crate::enums::Enum
247247
#[diagnostic::on_unimplemented(

crates/bevy_reflect/src/reflect.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{
2-
array::array_debug, enums::enum_debug, list_debug, map_debug, set_debug, struct_debug,
2+
array::array_debug, enums::enum_debug, list::list_debug, map_debug, set_debug, struct_debug,
33
tuple_debug, tuple_struct_debug, DynamicTypePath, DynamicTyped, OpaqueInfo, ReflectCloneError,
44
ReflectKind, ReflectKindMismatchError, ReflectMut, ReflectOwned, ReflectRef, TypeInfo,
55
TypePath, Typed,
@@ -115,7 +115,7 @@ where
115115
/// performant for such use cases.
116116
///
117117
/// [`DynamicStruct`]: crate::DynamicStruct
118-
/// [`DynamicList`]: crate::DynamicList
118+
/// [`DynamicList`]: crate::list::DynamicList
119119
/// [`TypeRegistry::get_type_info`]: crate::TypeRegistry::get_type_info
120120
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>;
121121

@@ -186,11 +186,11 @@ where
186186
/// [`TupleStruct`]: crate::TupleStruct
187187
/// [`Tuple`]: crate::Tuple
188188
/// [`Enum`]: crate::enums::Enum
189-
/// [`List`]: crate::List
189+
/// [`List`]: crate::list::List
190190
/// [`Array`]: crate::array::Array
191191
/// [`Map`]: crate::Map
192192
/// [`Set`]: crate::Set
193-
/// [`list_apply`]: crate::list_apply
193+
/// [`list_apply`]: crate::list::list_apply
194194
/// [`map_apply`]: crate::map_apply
195195
/// [`set_apply`]: crate::set_apply
196196
///
@@ -265,9 +265,9 @@ where
265265
/// ```
266266
///
267267
/// [kind]: PartialReflect::reflect_kind
268-
/// [`List`]: crate::List
269-
/// [`List::to_dynamic_list`]: crate::List::to_dynamic_list
270-
/// [`DynamicList`]: crate::DynamicList
268+
/// [`List`]: crate::list::List
269+
/// [`List::to_dynamic_list`]: crate::list::List::to_dynamic_list
270+
/// [`DynamicList`]: crate::list::DynamicList
271271
/// [`Struct`]: crate::Struct
272272
/// [`Struct::to_dynamic_struct`]: crate::Struct::to_dynamic_struct
273273
/// [`DynamicStruct`]: crate::DynamicStruct
@@ -352,7 +352,7 @@ where
352352
/// (e.g. [`List`], [`Map`]), will default to the format: `"Reflect(type_path)"`,
353353
/// where `type_path` is the [type path] of the underlying type.
354354
///
355-
/// [`List`]: crate::List
355+
/// [`List`]: crate::list::List
356356
/// [`Map`]: crate::Map
357357
/// [type path]: TypePath::type_path
358358
fn debug(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
@@ -381,7 +381,7 @@ where
381381
/// By default, this method will return `false`.
382382
///
383383
/// [`DynamicStruct`]: crate::DynamicStruct
384-
/// [`DynamicList`]: crate::DynamicList
384+
/// [`DynamicList`]: crate::list::DynamicList
385385
/// [`DynamicTuple`]: crate::DynamicTuple
386386
fn is_dynamic(&self) -> bool {
387387
false

0 commit comments

Comments
 (0)