[][src]Struct rask_wasm::communication::synchronization_memory::SynchronizationMemory

#[repr(align(4))]
#[repr(C)]pub struct SynchronizationMemory {
    pub elapsed_ms: i32,
    pub mouse: (i32, i32),
    pub canvas_size: (u32, u32),
    pub player: GameState,
    pub other: GameState,
    // some fields omitted
}

The SynchronizationMemory is the main interface to the main.js. It exposes some variables from the main.js and is used for the atomic wait cycle.

Fields

elapsed_ms: i32

Time elapsed since logic thread initialisation in milliseconds.

mouse: (i32, i32)

Current mouse position.

canvas_size: (u32, u32)

Canvas size in px.

player: GameStateother: GameState

Implementations

impl SynchronizationMemory[src]

The synchronization memory is a direct memory interface to the main.js. It is updated before each logic cycle.

pub const fn new() -> Self[src]

pub fn wait_for_main_thread_notify(&mut self)[src]

This functions lets the thread sleep until it is woken up by the main.js or a timeout is reached.

Trait Implementations

impl Debug for SynchronizationMemory[src]

Auto Trait Implementations

impl RefUnwindSafe for SynchronizationMemory

impl Send for SynchronizationMemory

impl Sync for SynchronizationMemory

impl Unpin for SynchronizationMemory

impl UnwindSafe for SynchronizationMemory

Blanket Implementations

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

impl<T> Any for T where
    T: Any

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

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

impl<S, T> Collide<[T]> for S where
    T: Collide<S>, 
[src]

impl<T> Event for T where
    T: Send + Sync + 'static, 

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

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

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Resource for T where
    T: Any + Send + Sync

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.