Struct handlemanager::HandleManager [−][src]
pub struct HandleManager { /* fields omitted */ }
Methods
impl HandleManager
[src]
impl HandleManager
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates a new handle manager with some default settings. You very likely want to change these to suit your use case.
pub fn with_alloc_policy(self, policy: AllocPolicy) -> Self
[src]
pub fn with_alloc_policy(self, policy: AllocPolicy) -> Self
Changes the allocation policy of handles. Panics if handles have already been issued.
pub fn with_release_policy(self, policy: ReleasePolicy) -> Self
[src]
pub fn with_release_policy(self, policy: ReleasePolicy) -> Self
Changes the release policy of this handle manager. Panics if handles have already been issued.
pub fn next(&mut self) -> Option<usize>
[src]
pub fn next(&mut self) -> Option<usize>
Retrieve a handle from the manager. Either generates a new ID if one cannot be recycled, or recycles one which was previously valid.
pub fn is_used(&self, id: usize) -> bool
[src]
pub fn is_used(&self, id: usize) -> bool
Checks if a given ID is currently known to the handle manager. Note that if you are using a policy which does not track freed values, this can only check if a handle has never been valid to this point.
pub fn release(&mut self, handle: usize) -> Result<(), ()>
[src]
pub fn release(&mut self, handle: usize) -> Result<(), ()>
Returns a handle to the handle manager. This can fail if the handle was not valid or is currently in a free list.
Trait Implementations
impl Default for HandleManager
[src]
impl Default for HandleManager
Auto Trait Implementations
impl Send for HandleManager
impl Send for HandleManager
impl Sync for HandleManager
impl Sync for HandleManager