Skip to main content

ServerStorage

Trait ServerStorage 

Source
pub trait ServerStorage: Server {
    type Storage: ComputeStorage;

    // Required method
    fn get_resource(
        &mut self,
        binding: BufferBinding,
        stream_id: StreamId,
    ) -> Result<ManagedResource<<Self::Storage as ComputeStorage>::Resource>, ServerError>;
}
Expand description

The storage a server allocates from, and the native resources it hands out. Kept off Server so that trait is object-safe: a resource’s type is the backend’s own, and only a caller that names the backend can receive one.

Required Associated Types§

Source

type Storage: ComputeStorage

The storage type defines how data is stored and accessed.

Required Methods§

Source

fn get_resource( &mut self, binding: BufferBinding, stream_id: StreamId, ) -> Result<ManagedResource<<Self::Storage as ComputeStorage>::Resource>, ServerError>

Given a resource handle, returns the storage resource.

The same claim check a read makes guards this too: a buffer a failed launch never filled reports the failure rather than handing back a pointer to whatever was there before. It costs a field read on a slice the resolution walks anyway.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§