pub trait ChunkWriteStorage<N, Ch> {
// Required methods
fn get_mut(&mut self, key: ChunkKey<N>) -> Option<&mut Ch>;
fn get_mut_or_insert_with(
&mut self,
key: ChunkKey<N>,
create_chunk: impl FnOnce() -> Ch,
) -> &mut Ch;
fn replace(&mut self, key: ChunkKey<N>, chunk: Ch) -> Option<Ch>;
fn write(&mut self, key: ChunkKey<N>, chunk: Ch);
fn delete(&mut self, key: ChunkKey<N>);
fn pop(&mut self, key: ChunkKey<N>) -> Option<Ch>;
}Expand description
Methods for writing chunks from storage.
Required Methods§
Sourcefn get_mut_or_insert_with(
&mut self,
key: ChunkKey<N>,
create_chunk: impl FnOnce() -> Ch,
) -> &mut Ch
fn get_mut_or_insert_with( &mut self, key: ChunkKey<N>, create_chunk: impl FnOnce() -> Ch, ) -> &mut Ch
Mutably borrow the chunk at key. If it doesn’t exist, insert the return value of create_chunk.
Sourcefn replace(&mut self, key: ChunkKey<N>, chunk: Ch) -> Option<Ch>
fn replace(&mut self, key: ChunkKey<N>, chunk: Ch) -> Option<Ch>
Replace the chunk at key with chunk, returning the old value.
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.