BufferWorldAccess

Trait BufferWorldAccess 

Source
pub trait BufferWorldAccess {
    // Required methods
    fn buffer_view<T>(
        &self,
        key: &BufferKey<T>,
    ) -> Result<BufferView<'_, T>, BufferError>
       where T: 'static + Send + Sync;
    fn buffer_gate_view(
        &self,
        key: impl Into<AnyBufferKey>,
    ) -> Result<BufferGateView<'_>, BufferError>;
    fn buffer_mut<T, U>(
        &mut self,
        key: &BufferKey<T>,
        f: impl FnOnce(BufferMut<'_, '_, '_, T>) -> U,
    ) -> Result<U, BufferError>
       where T: 'static + Send + Sync;
    fn buffer_gate_mut<U>(
        &mut self,
        key: impl Into<AnyBufferKey>,
        f: impl FnOnce(BufferGateMut<'_, '_, '_>) -> U,
    ) -> Result<U, BufferError>;
}
Expand description

This trait allows World to give you access to any buffer using a BufferKey

Required Methods§

Source

fn buffer_view<T>( &self, key: &BufferKey<T>, ) -> Result<BufferView<'_, T>, BufferError>
where T: 'static + Send + Sync,

Call this to get read-only access to a buffer from a World.

Alternatively you can use BufferAccess as a regular bevy system parameter, which does not need direct world access.

Source

fn buffer_gate_view( &self, key: impl Into<AnyBufferKey>, ) -> Result<BufferGateView<'_>, BufferError>

Call this to get read-only access to the gate of a buffer from a World.

Source

fn buffer_mut<T, U>( &mut self, key: &BufferKey<T>, f: impl FnOnce(BufferMut<'_, '_, '_, T>) -> U, ) -> Result<U, BufferError>
where T: 'static + Send + Sync,

Call this to get mutable access to a buffer.

Pass in a callback that will receive BufferMut, allowing it to view and modify the contents of the buffer.

Source

fn buffer_gate_mut<U>( &mut self, key: impl Into<AnyBufferKey>, f: impl FnOnce(BufferGateMut<'_, '_, '_>) -> U, ) -> Result<U, BufferError>

Call this to get mutable access to the gate of a buffer.

Pass in a callback that will receive BufferGateMut, allowing it to view and modify the gate of the buffer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§