#[non_exhaustive]pub enum DropPolicy {
MayDropItems,
MustNotDropItems,
}Expand description
Determines item dropping behavior when the container is dropped.
By default, the container will drop its items when it is dropped.
§Examples
use std::alloc::Layout;
use opaque_pool::{DropPolicy, OpaquePool};
// The drop policy is set at pool creation time.
let layout = Layout::new::<u32>();
let pool = OpaquePool::builder()
.layout(layout)
.drop_policy(DropPolicy::MustNotDropItems)
.build();Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
MayDropItems
The container will drop its items when the container is dropped. This is the default.
MustNotDropItems
The container will panic if it still contains items when it is dropped.
This may be valuable if there are external requirements before the items can be dropped. For example, it may be known that unsafe code is used to create out of band references to the items, with items only removed after such references have been dropped.
Trait Implementations§
Source§impl Clone for DropPolicy
impl Clone for DropPolicy
Source§fn clone(&self) -> DropPolicy
fn clone(&self) -> DropPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DropPolicy
impl Debug for DropPolicy
Source§impl Default for DropPolicy
impl Default for DropPolicy
Source§fn default() -> DropPolicy
fn default() -> DropPolicy
Returns the “default value” for a type. Read more
Source§impl PartialEq for DropPolicy
impl PartialEq for DropPolicy
impl Copy for DropPolicy
impl Eq for DropPolicy
impl StructuralPartialEq for DropPolicy
Auto Trait Implementations§
impl Freeze for DropPolicy
impl RefUnwindSafe for DropPolicy
impl Send for DropPolicy
impl Sync for DropPolicy
impl Unpin for DropPolicy
impl UnwindSafe for DropPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more