Skip to content

Commit 37eb231

Browse files
committed
FIRST PASSING LUA WORLD API TESTS
1 parent 2959959 commit 37eb231

File tree

6 files changed

+318
-287
lines changed

6 files changed

+318
-287
lines changed

crates/bevy_mod_scripting_core/src/bindings/proxy.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub trait Unproxy {
8282
_guard: &WorldAccessGuard<'w>,
8383
_accesses: &'o [WorldAccessUnit<'w>],
8484
_type_registry: &TypeRegistry,
85-
_allocator: &'o ReflectAllocator,
85+
_allocator: &ReflectAllocator,
8686
) -> ScriptResult<Self::Output<'o>> {
8787
self.unproxy()
8888
}
@@ -265,7 +265,7 @@ where
265265
guard: &WorldAccessGuard<'w>,
266266
accesses: &'o [WorldAccessUnit<'w>],
267267
type_registry: &TypeRegistry,
268-
allocator: &'o ReflectAllocator,
268+
allocator: &ReflectAllocator,
269269
) -> ScriptResult<Self::Output<'o>> {
270270
let reflect_ref: &ReflectReference = self.0.as_ref();
271271
let access = accesses.last().ok_or_else(|| {
@@ -326,7 +326,7 @@ where
326326
guard: &WorldAccessGuard<'w>,
327327
accesses: &'o [WorldAccessUnit<'w>],
328328
type_registry: &TypeRegistry,
329-
allocator: &'o ReflectAllocator,
329+
allocator: &ReflectAllocator,
330330
) -> ScriptResult<Self::Output<'o>> {
331331
let reflect_ref: &ReflectReference = self.0.as_ref();
332332
accesses
@@ -404,7 +404,7 @@ macro_rules! impl_unproxy_via_vec {
404404
guard: &WorldAccessGuard<'w>,
405405
accesses: &'o [WorldAccessUnit<'w>],
406406
type_registry: &TypeRegistry,
407-
allocator: &'o ReflectAllocator,
407+
allocator: &ReflectAllocator,
408408
) -> ScriptResult<Self::Output<'o>> {
409409
let mut out = Vec::with_capacity(self.len());
410410
let mut offset = 0;
@@ -523,7 +523,7 @@ impl<T: Unproxy> Unproxy for Option<T> {
523523
guard: &WorldAccessGuard<'w>,
524524
accesses: &'o [WorldAccessUnit<'w>],
525525
type_registry: &TypeRegistry,
526-
allocator: &'o ReflectAllocator,
526+
allocator: &ReflectAllocator,
527527
) -> ScriptResult<Self::Output<'o>> {
528528
if let Some(s) = self {
529529
let inner = s.unproxy_with_world(guard, accesses, type_registry, allocator)?;
@@ -565,13 +565,13 @@ impl<T: Proxy> Proxy for Option<T> {
565565
}
566566
}
567567

568-
impl<T: Proxy, E> Proxy for Result<T, E> {
569-
type Input<'a> = Result<T::Input<'a>, E>;
568+
impl<T: Proxy, E: Proxy> Proxy for Result<T, E> {
569+
type Input<'a> = Result<T::Input<'a>, E::Input<'a>>;
570570

571571
fn proxy(input: Self::Input<'_>) -> ScriptResult<Self> {
572572
match input {
573573
Ok(i) => Ok(Ok(T::proxy(i)?)),
574-
Err(e) => Ok(Err(e)),
574+
Err(e) => Ok(Err(E::proxy(e)?)),
575575
}
576576
}
577577

@@ -581,7 +581,7 @@ impl<T: Proxy, E> Proxy for Result<T, E> {
581581
) -> ScriptResult<Self> {
582582
match input {
583583
Ok(i) => Ok(Ok(T::proxy_with_allocator(i, _allocator)?)),
584-
Err(e) => Ok(Err(e)),
584+
Err(e) => Ok(Err(E::proxy_with_allocator(e, _allocator)?)),
585585
}
586586
}
587587
}
@@ -601,7 +601,7 @@ impl<T: Unproxy, E: Unproxy> Unproxy for Result<T, E> {
601601
guard: &WorldAccessGuard<'w>,
602602
accesses: &'o [WorldAccessUnit<'w>],
603603
type_registry: &TypeRegistry,
604-
allocator: &'o ReflectAllocator,
604+
allocator: &ReflectAllocator,
605605
) -> ScriptResult<Self::Output<'o>> {
606606
match self {
607607
Ok(s) => Ok(Ok(s.unproxy_with_world(
@@ -808,7 +808,7 @@ macro_rules! impl_tuple_unproxy_proxy {
808808
_guard: &WorldAccessGuard<'w>,
809809
_accesses: &'o [WorldAccessUnit<'w>],
810810
_type_registry: &TypeRegistry,
811-
_allocator: &'o ReflectAllocator,
811+
_allocator: &ReflectAllocator,
812812
) -> ScriptResult<Self::Output<'o>> {
813813
let mut _offset = 0;
814814

crates/bevy_mod_scripting_core/src/bindings/reference.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl ReflectReference {
185185
world: UnsafeWorldCell<'w>,
186186
access: &'c WorldAccessWrite<'w>,
187187
type_registry: &TypeRegistry,
188-
allocator: Option<&'c ReflectAllocator>,
188+
allocator: Option<&ReflectAllocator>,
189189
) -> ScriptResult<&'c dyn PartialReflect> {
190190
self.expect_read_access(access, type_registry, allocator, world)?;
191191
// Safety: since we have read access to the underlying componentId we can safely access the component
@@ -202,7 +202,7 @@ impl ReflectReference {
202202
world: UnsafeWorldCell<'w>,
203203
access: &'c mut WorldAccessWrite<'w>,
204204
type_registry: &TypeRegistry,
205-
allocator: Option<&'c ReflectAllocator>,
205+
allocator: Option<&ReflectAllocator>,
206206
) -> ScriptResult<&'c mut dyn PartialReflect> {
207207
self.expect_write_access(access, type_registry, allocator, world)?;
208208
// Safety: since we have write access to the underlying reflect access id we can safely access the component
@@ -218,7 +218,7 @@ impl ReflectReference {
218218
&self,
219219
world: UnsafeWorldCell<'w>,
220220
type_registry: &TypeRegistry,
221-
allocator: Option<&'w ReflectAllocator>,
221+
allocator: Option<&ReflectAllocator>,
222222
) -> ScriptResult<&'w dyn PartialReflect> {
223223
if let ReflectBase::Owned(id) = &self.base.base_id {
224224
let allocator =
@@ -266,7 +266,7 @@ impl ReflectReference {
266266
&self,
267267
world: UnsafeWorldCell<'w>,
268268
type_registry: &TypeRegistry,
269-
allocator: Option<&'w ReflectAllocator>,
269+
allocator: Option<&ReflectAllocator>,
270270
) -> ScriptResult<&'w mut dyn PartialReflect> {
271271
if let ReflectBase::Owned(id) = &self.base.base_id {
272272
let allocator = allocator.ok_or_else(|| ScriptError::new_reflection_error("Allocator missing"))?;

0 commit comments

Comments
 (0)