Skip to content

Commit 96325a2

Browse files
committed
Bump Bevy to 0.15.0-rc.3.
1 parent c4769ad commit 96325a2

File tree

7 files changed

+29
-23
lines changed

7 files changed

+29
-23
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = "0.8.0"
1111
rust-version = "1.76.0"
1212

1313
[workspace.dependencies]
14-
bevy = { version = "0.14", default-features = false }
14+
bevy = { version = "0.15.0-rc.3", default-features = false }
1515
serde = "1"
1616
serde_derive = "1"
1717
rand_core = { version = "0.6", features = ["std"] }

bevy_prng/src/newtype.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ macro_rules! newtype_prng {
88
)]
99
#[cfg_attr(
1010
all(feature = "serialize"),
11-
reflect_value(Debug, PartialEq, FromReflect, Serialize, Deserialize)
11+
reflect(opaque, Debug, PartialEq, FromReflect, Serialize, Deserialize)
1212
)]
1313
#[cfg_attr(
1414
all(not(feature = "serialize")),
15-
reflect_value(Debug, PartialEq, FromReflect)
15+
reflect(opaque, Debug, PartialEq, FromReflect)
1616
)]
1717
#[cfg_attr(docsrs, doc(cfg(feature = $feature)))]
1818
#[type_path = "bevy_prng"]

src/component.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ mod tests {
295295
fn rng_untyped_serialization() {
296296
use bevy::reflect::{
297297
serde::{ReflectDeserializer, ReflectSerializer},
298-
TypeRegistry,
298+
FromReflect, TypeRegistry,
299299
};
300300
use ron::to_string;
301301
use serde::de::DeserializeSeed;
@@ -323,7 +323,7 @@ mod tests {
323323

324324
let value = de.deserialize(&mut deserializer).unwrap();
325325

326-
let mut dynamic = value.take::<EntropyComponent<ChaCha8Rng>>().unwrap();
326+
let mut dynamic = EntropyComponent::<ChaCha8Rng>::take_from_reflect(value).unwrap();
327327

328328
// The two instances should be the same
329329
assert_eq!(
@@ -343,7 +343,7 @@ mod tests {
343343
fn rng_typed_serialization() {
344344
use bevy::reflect::{
345345
serde::{TypedReflectDeserializer, TypedReflectSerializer},
346-
GetTypeRegistration, TypeRegistry,
346+
FromReflect, GetTypeRegistration, TypeRegistry,
347347
};
348348
use ron::ser::to_string;
349349
use serde::de::DeserializeSeed;
@@ -373,7 +373,7 @@ mod tests {
373373

374374
let value = de.deserialize(&mut deserializer).unwrap();
375375

376-
let mut dynamic = value.take::<EntropyComponent<ChaCha8Rng>>().unwrap();
376+
let mut dynamic = EntropyComponent::<ChaCha8Rng>::take_from_reflect(value).unwrap();
377377

378378
// The two instances should be the same
379379
assert_eq!(

src/plugin.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
use crate::{component::EntropyComponent, resource::GlobalEntropy, seed::RngSeed};
2-
use bevy::prelude::{App, Plugin};
2+
use bevy::{
3+
prelude::{App, Plugin},
4+
reflect::Typed,
5+
};
36
use bevy_prng::{EntropySeed, SeedableEntropySource};
47
use rand_core::SeedableRng;
58

@@ -60,9 +63,9 @@ where
6063
}
6164
}
6265

63-
impl<R: SeedableEntropySource + 'static> Plugin for EntropyPlugin<R>
66+
impl<R: SeedableEntropySource + Typed + 'static> Plugin for EntropyPlugin<R>
6467
where
65-
R::Seed: EntropySeed,
68+
R::Seed: EntropySeed + Typed,
6669
{
6770
fn build(&self, app: &mut App) {
6871
app.register_type::<GlobalEntropy<R>>()

src/resource.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ use crate::{
88
ForkableRng, ForkableSeed,
99
},
1010
};
11-
use bevy::prelude::{Reflect, ReflectFromReflect, ReflectFromWorld, ReflectResource, Resource};
11+
use bevy::{
12+
prelude::{Reflect, ReflectFromReflect, ReflectFromWorld, ReflectResource, Resource},
13+
reflect::Typed,
14+
};
1215
use bevy_prng::SeedableEntropySource;
1316
use rand_core::{RngCore, SeedableRng};
1417

@@ -62,8 +65,8 @@ use serde::{Deserialize, Serialize};
6265
feature = "serialize",
6366
serde(bound(deserialize = "R: for<'a> Deserialize<'a>, R::Seed: for<'a> Deserialize<'a>"))
6467
)]
65-
#[cfg_attr(feature = "serialize", reflect(where R::Seed: PartialEq + Debug + Sync + Send + Clone + Serialize + for<'a> Deserialize<'a>))]
66-
#[cfg_attr(not(feature = "serialize"), reflect(where R::Seed: PartialEq + Debug + Sync + Send + Clone))]
68+
#[cfg_attr(feature = "serialize", reflect(where R::Seed: PartialEq + Debug + Sync + Send + Clone + Serialize + Typed + for<'a> Deserialize<'a>))]
69+
#[cfg_attr(not(feature = "serialize"), reflect(where R::Seed: PartialEq + Debug + Sync + Send + Clone + Typed))]
6770
pub struct GlobalEntropy<R: SeedableEntropySource + 'static> {
6871
seed: R::Seed,
6972
rng: R,
@@ -273,7 +276,7 @@ mod tests {
273276
fn rng_untyped_serialization() {
274277
use bevy::reflect::{
275278
serde::{ReflectDeserializer, ReflectSerializer},
276-
TypeRegistry,
279+
FromReflect, TypeRegistry,
277280
};
278281
use ron::ser::to_string;
279282
use serde::de::DeserializeSeed;
@@ -301,7 +304,7 @@ mod tests {
301304

302305
let value = de.deserialize(&mut deserializer).unwrap();
303306

304-
let mut dynamic = value.take::<GlobalEntropy<ChaCha8Rng>>().unwrap();
307+
let mut dynamic = GlobalEntropy::<ChaCha8Rng>::take_from_reflect(value).unwrap();
305308

306309
// The two instances should be the same
307310
assert_eq!(
@@ -321,7 +324,7 @@ mod tests {
321324
fn rng_typed_serialization() {
322325
use bevy::reflect::{
323326
serde::{TypedReflectDeserializer, TypedReflectSerializer},
324-
GetTypeRegistration, TypeRegistry,
327+
FromReflect, GetTypeRegistration, TypeRegistry,
325328
};
326329
use ron::to_string;
327330
use serde::de::DeserializeSeed;
@@ -351,7 +354,7 @@ mod tests {
351354

352355
let value = de.deserialize(&mut deserializer).unwrap();
353356

354-
let mut dynamic = value.take::<GlobalEntropy<ChaCha8Rng>>().unwrap();
357+
let mut dynamic = GlobalEntropy::<ChaCha8Rng>::take_from_reflect(value).unwrap();
355358

356359
// The two instances should be the same
357360
assert_eq!(

src/seed.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ mod tests {
103103

104104
assert!(value.is_dynamic());
105105
assert!(value.represents::<RngSeed<WyRand>>());
106-
assert!(!value.is::<RngSeed<WyRand>>());
106+
assert!(!value.try_downcast_ref::<RngSeed<WyRand>>().is_some());
107107

108-
let recreated = RngSeed::<WyRand>::from_reflect(value.as_reflect()).unwrap();
108+
let recreated = RngSeed::<WyRand>::from_reflect(value.as_ref()).unwrap();
109109

110110
assert_eq!(val.clone_seed(), recreated.clone_seed());
111111
}

tests/integration/reseeding.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ fn observer_global_reseeding() {
199199
.zip(seeds.map(u64::from_ne_bytes))
200200
.for_each(|(expected, actual)| assert_ne!(expected, actual));
201201
})
202-
.observe(reseed);
202+
.add_observer(reseed);
203203

204204
app.run();
205205
}
@@ -278,7 +278,7 @@ fn observer_children_reseeding() {
278278

279279
let mut source = commands.spawn(seed);
280280

281-
source.add(|mut entity: EntityWorldMut| {
281+
source.queue(|mut entity: EntityWorldMut| {
282282
// FORK! Quicker than allocating a new Vec of components to spawn.
283283
let mut rng = entity
284284
.get_mut::<EntropyComponent<WyRand>>()
@@ -361,8 +361,8 @@ fn observer_children_reseeding() {
361361
assert_eq!(children.iter().size_hint().0, 5);
362362
},
363363
)
364-
.observe(reseed)
365-
.observe(reseed_children);
364+
.add_observer(reseed)
365+
.add_observer(reseed_children);
366366

367367
app.run();
368368
}

0 commit comments

Comments
 (0)