Skip to main content

OwnedGameEvent

Struct OwnedGameEvent 

Source
pub struct OwnedGameEvent<'s> { /* private fields */ }
Expand description

A game event this plugin created, which is freed when dropped unless fired.

Implementations§

Source§

impl<'s> OwnedGameEvent<'s>

Source

pub fn as_event(&self) -> GameEvent<'_>

Reads the event. The handle cannot outlive this owner.

Source

pub fn as_event_mut(&mut self) -> GameEventMut<'_>

Edits the event through a handle, which cannot outlive this owner.

Source

pub fn fire(self, broadcast: bool) -> Result<(), FireEventError>

Delivers the event to every listener, and to clients if broadcast is set.

Listeners run synchronously, so this may run arbitrary game and plugin code, including this plugin’s own listeners. Fails if the manager reports that it did not fire the event, which the engine frees either way.

Source

pub fn set_bool(&mut self, key: &CStr, value: bool)

Sets a boolean value for key.

Source

pub fn set_float(&mut self, key: &CStr, value: f32)

Sets a float value for key.

Source

pub fn set_int(&mut self, key: &CStr, value: c_int)

Sets an integer value for key.

Source

pub fn set_string(&mut self, key: &CStr, value: &CStr)

Sets a string value for key. The event stores a copy of value.

Source

pub fn set_uint64(&mut self, key: &CStr, value: u64)

Sets a 64-bit value for key.

Trait Implementations§

Source§

impl<'s> Debug for OwnedGameEvent<'s>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for OwnedGameEvent<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'s> !Send for OwnedGameEvent<'s>

§

impl<'s> !Sync for OwnedGameEvent<'s>

§

impl<'s> Freeze for OwnedGameEvent<'s>

§

impl<'s> RefUnwindSafe for OwnedGameEvent<'s>

§

impl<'s> Unpin for OwnedGameEvent<'s>

§

impl<'s> UnsafeUnpin for OwnedGameEvent<'s>

§

impl<'s> UnwindSafe for OwnedGameEvent<'s>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.