Trait chunky::Handler [−][src]
pub trait Handler: Sized { fn create_chunk(ident: Ident, size: usize) -> *mut u8; fn load_or_create_chunk(ident: Ident, size: usize) -> (*mut u8, bool); fn load_chunk(ident: Ident) -> (*mut u8, usize); unsafe fn unload_chunk(ptr: *mut u8, size: usize); unsafe fn destroy_chunk(ptr: *mut u8, size: usize); }
A strategy for managing chunks
Required Methods
fn create_chunk(ident: Ident, size: usize) -> *mut u8
Create a new chunk with a given identifier, assumes it doesn't exist
fn load_or_create_chunk(ident: Ident, size: usize) -> (*mut u8, bool)
Load a chunk with a given identifier, or create it if it doesn't exist
fn load_chunk(ident: Ident) -> (*mut u8, usize)
Load a chunk with a given identifier, assumes it exists
unsafe fn unload_chunk(ptr: *mut u8, size: usize)
Deallocate a chunk, but keep any persisted representation of it
unsafe fn destroy_chunk(ptr: *mut u8, size: usize)
Deallocate a chunk and delete any persisted representation of it
Implementors
impl Handler for HeapHandler