DataList

Struct DataList 

Source
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>

Source

pub fn unwrap_entity<'a>(&'a self) -> &'a Entity

Examples found in repository?
examples/render_gui_system.rs (line 75)
74    fn process_d(&mut self, _ : &mut Entity, data : &mut DataList) {
75        let render_data = data.unwrap_entity().get_component::<RenderData>();
76        let _gui_data   = data.unwrap_entity().get_component::<HeavyGuiData>();
77        render_data.facade.borrow_mut().draw_something("gui gui gui");
78    }
More examples
Hide additional 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    }
Source

pub fn unwrap_entity_nth<'a>(&'a self, n: usize) -> &'a Entity

Source

pub fn unwrap_entity_mut<'a>(&'a mut self) -> &'a mut Entity

Source

pub fn unwrap_all<'a>(&'a mut self) -> &'a mut Vec<&'b mut Entity>

Source

pub fn unwrap_nth<'a>(&'a self, n: usize) -> &'a Vec<&'b mut Entity>

Source

pub fn unwrap_mut_nth<'a>(&'a mut self, n: usize) -> &'a mut Vec<&'b mut Entity>

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.