@@ -4,7 +4,7 @@ use syn::{DeriveInput, Ident, Type};
4
4
5
5
use crate :: Result ;
6
6
7
- pub ( crate ) fn impl_buffer_map_layout ( ast : DeriveInput ) -> Result < TokenStream > {
7
+ pub ( crate ) fn impl_joined_value ( ast : DeriveInput ) -> Result < TokenStream > {
8
8
let struct_ident = ast. ident ;
9
9
let ( field_ident, field_type) = match ast. data {
10
10
syn:: Data :: Struct ( data) => get_fields_map ( data. fields ) ?,
@@ -15,19 +15,21 @@ pub(crate) fn impl_buffer_map_layout(ast: DeriveInput) -> Result<TokenStream> {
15
15
16
16
let gen = quote ! {
17
17
impl BufferMapLayout for #struct_ident {
18
- fn is_compatible( buffers: & BufferMap ) -> Result <( ) , IncompatibleLayout > {
19
- let mut compatibility = IncompatibleLayout :: default ( ) ;
18
+ fn is_compatible( buffers: & BufferMap ) -> Result <( ) , :: bevy_impulse :: IncompatibleLayout > {
19
+ let mut compatibility = :: bevy_impulse :: IncompatibleLayout :: default ( ) ;
20
20
#(
21
21
compatibility. require_buffer:: <#field_type>( #map_key, buffers) ;
22
22
) *
23
23
compatibility. into_result( )
24
24
}
25
25
26
26
fn buffered_count(
27
- buffers: & BufferMap ,
28
- session: Entity ,
29
- world: & World ,
30
- ) -> Result <usize , OperationError > {
27
+ buffers: & :: bevy_impulse:: BufferMap ,
28
+ session: :: bevy_ecs:: prelude:: Entity ,
29
+ world: & :: bevy_ecs:: prelude:: World ,
30
+ ) -> Result <usize , :: bevy_impulse:: OperationError > {
31
+ use :: bevy_impulse:: { InspectBuffer , OrBroken } ;
32
+
31
33
#(
32
34
let #field_ident = world
33
35
. get_entity( buffers. get( #map_key) . or_broken( ) ?. id( ) )
@@ -43,10 +45,12 @@ pub(crate) fn impl_buffer_map_layout(ast: DeriveInput) -> Result<TokenStream> {
43
45
}
44
46
45
47
fn ensure_active_session(
46
- buffers: & BufferMap ,
47
- session: Entity ,
48
- world: & mut World ,
49
- ) -> OperationResult {
48
+ buffers: & :: bevy_impulse:: BufferMap ,
49
+ session: :: bevy_ecs:: prelude:: Entity ,
50
+ world: & mut :: bevy_ecs:: prelude:: World ,
51
+ ) -> :: bevy_impulse:: OperationResult {
52
+ use :: bevy_impulse:: { ManageBuffer , OrBroken } ;
53
+
50
54
#(
51
55
world
52
56
. get_entity_mut( buffers. get( #map_key) . or_broken( ) ?. id( ) )
@@ -58,14 +62,16 @@ pub(crate) fn impl_buffer_map_layout(ast: DeriveInput) -> Result<TokenStream> {
58
62
}
59
63
}
60
64
61
- impl JoinedValue for #struct_ident {
65
+ impl :: bevy_impulse :: JoinedValue for #struct_ident {
62
66
type Buffers = #struct_buffer_ident;
63
67
64
68
fn pull(
65
- buffers: & BufferMap ,
66
- session: Entity ,
67
- world: & mut World ,
68
- ) -> Result <Self , OperationError > {
69
+ buffers: & :: bevy_impulse:: BufferMap ,
70
+ session: :: bevy_ecs:: prelude:: Entity ,
71
+ world: & mut :: bevy_ecs:: prelude:: World ,
72
+ ) -> Result <Self , :: bevy_impulse:: OperationError > {
73
+ use :: bevy_impulse:: { ManageBuffer , OrBroken } ;
74
+
69
75
#(
70
76
let #field_ident = world
71
77
. get_entity_mut( buffers. get( #map_key) . or_broken( ) ?. id( ) )
@@ -83,15 +89,15 @@ pub(crate) fn impl_buffer_map_layout(ast: DeriveInput) -> Result<TokenStream> {
83
89
84
90
struct #struct_buffer_ident {
85
91
#(
86
- #field_ident: Buffer <#field_type>
92
+ #field_ident: :: bevy_impulse :: Buffer <#field_type>
87
93
) , *
88
94
}
89
95
90
- impl From <#struct_buffer_ident> for BufferMap {
96
+ impl From <#struct_buffer_ident> for :: bevy_impulse :: BufferMap {
91
97
fn from( value: #struct_buffer_ident) -> Self {
92
- let mut buffers = BufferMap :: default ( ) ;
98
+ let mut buffers = :: bevy_impulse :: BufferMap :: default ( ) ;
93
99
#(
94
- buffers. insert( Cow :: Borrowed ( #map_key) , value. #field_ident) ;
100
+ buffers. insert( std :: borrow :: Cow :: Borrowed ( #map_key) , value. #field_ident) ;
95
101
) *
96
102
buffers
97
103
}
0 commit comments