use crate::storage::{ComputeStorage, StorageHandle, StorageId};
pub trait MemoryHandle<Binding>: Clone + Send + Sync + core::fmt::Debug {
fn can_mut(&self) -> bool;
fn binding(self) -> Binding;
}
pub trait MemoryBinding: Clone + Send + Sync + core::fmt::Debug {}
pub trait MemoryManagement<Storage: ComputeStorage>: Send + core::fmt::Debug {
type Handle: MemoryHandle<Self::Binding>;
type Binding: MemoryBinding;
fn get(&mut self, binding: Self::Binding) -> StorageHandle;
fn get_resource(&mut self, binding: Self::Binding) -> Storage::Resource {
let handle = self.get(binding);
self.storage().get(&handle)
}
fn reserve(&mut self, size: usize, exclude: &[StorageId]) -> Self::Handle;
fn alloc(&mut self, size: usize) -> Self::Handle;
fn dealloc(&mut self, binding: Self::Binding);
fn storage(&mut self) -> &mut Storage;
}