pub struct DataList<'a> { /* private fields */ }Expand description
list with additional entitiy packs from data aspect
Strongly recommends not use this ever, only for macroses!
Implementations§
Source§impl<'b> DataList<'b>
impl<'b> DataList<'b>
Sourcepub fn unwrap_entity<'a>(&'a self) -> &'a Entity
pub fn unwrap_entity<'a>(&'a self) -> &'a Entity
Examples found in repository?
More examples
examples/process_types.rs (line 35)
34 fn process_d(&mut self, entity : &mut Entity, data : &mut DataList) {
35 let cam = data.unwrap_entity();
36 let cam = cam.get_component::<Camera>();
37
38 let pos = entity.get_component::<Position>();
39 let mesh = entity.get_component::<Mesh>();
40
41 println!("{}, {}, seen from camera pos: {:?}", mesh.mesh, pos.pos[0], cam.pos);
42 }
43}
44
45pub struct DeferRenderSystem;
46
47impl System for DeferRenderSystem {
48 fn aspect(&self) -> Aspect {
49 Aspect::all2::<Position, Mesh>()
50 }
51 fn data_aspects(&self) -> Vec<Aspect> {
52 vec![Aspect::all::<Camera>()]
53 }
54 fn process_all(&mut self,
55 entities : &mut Vec<&mut Entity>,
56 _ : &mut WorldHandle,
57 data : &mut DataList) {
58 entities.sort_by(|e1, e2| {
59 let defer1 = e1.get_component::<DeferMesh>();
60 let defer2 = e2.get_component::<DeferMesh>();
61 defer1.order.cmp(&defer2.order)
62 });
63 for entity in entities {
64 let cam = data.unwrap_entity();
65 let cam = cam.get_component::<Camera>();
66
67 let mesh = entity.get_component::<Mesh>();
68
69 println!("{}, seen from camera pos: {:?}", mesh.mesh, cam.pos);
70 }
71 }pub fn unwrap_entity_nth<'a>(&'a self, n: usize) -> &'a Entity
pub fn unwrap_entity_mut<'a>(&'a mut self) -> &'a mut Entity
pub fn unwrap_all<'a>(&'a mut self) -> &'a mut Vec<&'b mut Entity>
pub fn unwrap_nth<'a>(&'a self, n: usize) -> &'a Vec<&'b mut Entity>
pub fn unwrap_mut_nth<'a>(&'a mut self, n: usize) -> &'a mut Vec<&'b mut Entity>
pub fn new( entity_manager: &mut EntityManager<'_>, ids: &Vec<HashSet<i32>>, ) -> DataList<'b>
Auto Trait Implementations§
impl<'a> Freeze for DataList<'a>
impl<'a> !RefUnwindSafe for DataList<'a>
impl<'a> !Send for DataList<'a>
impl<'a> !Sync for DataList<'a>
impl<'a> Unpin for DataList<'a>
impl<'a> !UnwindSafe for DataList<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more