Trait shipyard::AddComponent[][src]

pub trait AddComponent {
    type Component;
    fn add_component_unchecked(
        &mut self,
        entity: EntityId,
        component: Self::Component
    ); }

Defines how components are added to an existing entity.

Associated Types

Loading content...

Required methods

fn add_component_unchecked(
    &mut self,
    entity: EntityId,
    component: Self::Component
)
[src]

Adds component to entity, multiple components can be added at the same time using a tuple.
This function does not check entity is alive. It’s possible to add components to removed entities.
Use Entities::add_component if you’re unsure.

Example

use shipyard::{World, EntitiesViewMut, ViewMut, AddComponent};

let world = World::new();

let (mut entities, mut u32s) = world.borrow::<(EntitiesViewMut, ViewMut<u32>)>().unwrap();
let entity = entities.add_entity((), ());

u32s.add_component_unchecked(entity, 0);
Loading content...

Implementations on Foreign Types

impl AddComponent for ()[src]

type Component = ()

impl<ViewA: AddComponent> AddComponent for (ViewA,)[src]

type Component = (ViewA::Component,)

impl<ViewA: AddComponent, ViewB: AddComponent> AddComponent for (ViewA, ViewB)[src]

type Component = (ViewA::Component, ViewB::Component)

impl<ViewA: AddComponent, ViewB: AddComponent, ViewC: AddComponent> AddComponent for (ViewA, ViewB, ViewC)[src]

type Component = (ViewA::Component, ViewB::Component, ViewC::Component)

impl<ViewA: AddComponent, ViewB: AddComponent, ViewC: AddComponent, ViewD: AddComponent> AddComponent for (ViewA, ViewB, ViewC, ViewD)[src]

type Component = (ViewA::Component, ViewB::Component, ViewC::Component, ViewD::Component)

impl<ViewA: AddComponent, ViewB: AddComponent, ViewC: AddComponent, ViewD: AddComponent, ViewE: AddComponent> AddComponent for (ViewA, ViewB, ViewC, ViewD, ViewE)[src]

type Component = (ViewA::Component, ViewB::Component, ViewC::Component, ViewD::Component, ViewE::Component)

impl<ViewA: AddComponent, ViewB: AddComponent, ViewC: AddComponent, ViewD: AddComponent, ViewE: AddComponent, ViewF: AddComponent> AddComponent for (ViewA, ViewB, ViewC, ViewD, ViewE, ViewF)[src]

type Component = (ViewA::Component, ViewB::Component, ViewC::Component, ViewD::Component, ViewE::Component, ViewF::Component)

impl<ViewA: AddComponent, ViewB: AddComponent, ViewC: AddComponent, ViewD: AddComponent, ViewE: AddComponent, ViewF: AddComponent, ViewG: AddComponent> AddComponent for (ViewA, ViewB, ViewC, ViewD, ViewE, ViewF, ViewG)[src]

type Component = (ViewA::Component, ViewB::Component, ViewC::Component, ViewD::Component, ViewE::Component, ViewF::Component, ViewG::Component)

impl<ViewA: AddComponent, ViewB: AddComponent, ViewC: AddComponent, ViewD: AddComponent, ViewE: AddComponent, ViewF: AddComponent, ViewG: AddComponent, ViewH: AddComponent> AddComponent for (ViewA, ViewB, ViewC, ViewD, ViewE, ViewF, ViewG, ViewH)[src]

type Component = (ViewA::Component, ViewB::Component, ViewC::Component, ViewD::Component, ViewE::Component, ViewF::Component, ViewG::Component, ViewH::Component)

impl<ViewA: AddComponent, ViewB: AddComponent, ViewC: AddComponent, ViewD: AddComponent, ViewE: AddComponent, ViewF: AddComponent, ViewG: AddComponent, ViewH: AddComponent, ViewI: AddComponent> AddComponent for (ViewA, ViewB, ViewC, ViewD, ViewE, ViewF, ViewG, ViewH, ViewI)[src]

type Component = (ViewA::Component, ViewB::Component, ViewC::Component, ViewD::Component, ViewE::Component, ViewF::Component, ViewG::Component, ViewH::Component, ViewI::Component)

impl<ViewA: AddComponent, ViewB: AddComponent, ViewC: AddComponent, ViewD: AddComponent, ViewE: AddComponent, ViewF: AddComponent, ViewG: AddComponent, ViewH: AddComponent, ViewI: AddComponent, ViewJ: AddComponent> AddComponent for (ViewA, ViewB, ViewC, ViewD, ViewE, ViewF, ViewG, ViewH, ViewI, ViewJ)[src]

type Component = (ViewA::Component, ViewB::Component, ViewC::Component, ViewD::Component, ViewE::Component, ViewF::Component, ViewG::Component, ViewH::Component, ViewI::Component, ViewJ::Component)

Loading content...

Implementors

impl<T: 'static> AddComponent for &mut ViewMut<'_, T>[src]

type Component = T

impl<T: 'static> AddComponent for ViewMut<'_, T>[src]

type Component = T

Loading content...