[][src]Struct weasel::object::CreateObject

pub struct CreateObject<R: BattleRules> { /* fields omitted */ }

Event to create a new object.

Examples

use weasel::{
    battle_rules, rules::empty::*, Battle, BattleController, BattleRules, CreateObject,
    EventTrigger, Server,
};

battle_rules! {}

let battle = Battle::builder(CustomRules::new()).build();
let mut server = Server::builder(battle).build();

let object_id = 1;
let position = ();
CreateObject::trigger(&mut server, object_id, position)
    .fire()
    .unwrap();
assert_eq!(server.battle().entities().objects().count(), 1);

Implementations

impl<R: BattleRules> CreateObject<R>[src]

pub fn trigger<'a, P: EventProcessor<R>>(
    processor: &'a mut P,
    id: ObjectId<R>,
    position: Position<R>
) -> CreateObjectTrigger<'a, R, P>
[src]

Returns a trigger for this event.

pub fn id(&self) -> &ObjectId<R>[src]

Returns the id of the object to be created.

pub fn position(&self) -> &Position<R>[src]

Returns the position that the object will take.

pub fn statistics_seed(&self) -> &Option<StatisticsSeed<R>>[src]

Returns the seed to generate the object's statistics.

Trait Implementations

impl<R: BattleRules> Clone for CreateObject<R>[src]

impl<R: BattleRules> Debug for CreateObject<R>[src]

impl<'de, R: BattleRules> Deserialize<'de> for CreateObject<R> where
    ObjectId<R>: Deserialize<'de>,
    Position<R>: Deserialize<'de>,
    Option<StatisticsSeed<R>>: Deserialize<'de>, 
[src]

impl<R: BattleRules + 'static> Event<R> for CreateObject<R>[src]

impl<R: BattleRules> Serialize for CreateObject<R> where
    ObjectId<R>: Serialize,
    Position<R>: Serialize,
    Option<StatisticsSeed<R>>: Serialize
[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for CreateObject<R> where
    <R as BattleRules>::CR: CharacterRules<R>,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: RefUnwindSafe,
    <<R as BattleRules>::SR as SpaceRules<R>>::Position: RefUnwindSafe,
    <<R as BattleRules>::CR as CharacterRules<R>>::StatisticsSeed: RefUnwindSafe

impl<R> Send for CreateObject<R> where
    <R as BattleRules>::CR: CharacterRules<R>,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: Send,
    <<R as BattleRules>::SR as SpaceRules<R>>::Position: Send,
    <<R as BattleRules>::CR as CharacterRules<R>>::StatisticsSeed: Send

impl<R> Sync for CreateObject<R> where
    <R as BattleRules>::CR: CharacterRules<R>,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: Sync,
    <<R as BattleRules>::SR as SpaceRules<R>>::Position: Sync,
    <<R as BattleRules>::CR as CharacterRules<R>>::StatisticsSeed: Sync

impl<R> Unpin for CreateObject<R> where
    <R as BattleRules>::CR: CharacterRules<R>,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: Unpin,
    <<R as BattleRules>::SR as SpaceRules<R>>::Position: Unpin,
    <<R as BattleRules>::CR as CharacterRules<R>>::StatisticsSeed: Unpin

impl<R> UnwindSafe for CreateObject<R> where
    <R as BattleRules>::CR: CharacterRules<R>,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: UnwindSafe,
    <<R as BattleRules>::SR as SpaceRules<R>>::Position: UnwindSafe,
    <<R as BattleRules>::CR as CharacterRules<R>>::StatisticsSeed: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,