Skip to main content

ScriptMessagePayload

Trait ScriptMessagePayload 

Source
pub trait ScriptMessagePayload:
    Any
    + Send
    + Debug {
    // Provided method
    fn get_dynamic_type_id(&self) -> Option<DynamicTypeId> { ... }
}
Expand description

A script message’s payload. Use #[derive(ScriptMessagePayload)] to implement this trait:

    use fyrox_impl::script::ScriptMessagePayload;
    #[derive(Debug, ScriptMessagePayload)]
    struct MyStruct {
    }

Provided Methods§

Source

fn get_dynamic_type_id(&self) -> Option<DynamicTypeId>

By default messages are dispatched by TypeId::of::<Self>().

If this method returns Some, then the message become dynamically typed. Dynamically typed messages are dispatched by the returned type identifier instead of static type. Subscriptions to dynamically typed messages are managed by ScriptMessageDispatcher::subscribe_dynamic_to and ScriptMessageDispatcher::unsubscribe_dynamic_from

Implementations§

Source§

impl dyn ScriptMessagePayload

Source

pub fn downcast_ref<T: 'static>(&self) -> Option<&T>

Tries to cast the payload to a particular type.

Source

pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T>

Tries to cast the payload to a particular type.

Implementors§