#[repr(C)]pub struct AllocationOptions {
pub allow_overcommit: bool,
pub at_safepoint: bool,
pub allow_oom_call: bool,
}Expand description
Allow specifying different behaviors with Allocator::alloc_with_options.
Fields§
§allow_overcommit: boolWhether over-committing is allowed at this allocation site. Over-committing means the allocation is allowed to go beyond the current heap size. But it is not guaranteed to succeed.
The default is false.
Note that regardless of the value of allow_overcommit, the allocation may trigger GC if
the GC trigger considers it needed.
at_safepoint: boolWhether the allocation is at a safepoint.
The default is true.
If true, the allocation is allowed to block for GC.
If false, the allocation will immediately return a null address if the allocation cannot
be satisfied without a GC.
allow_oom_call: boolWhether the allocation is allowed to call Collection::out_of_memory.
The default is true.
If true, the allocation will call Collection::out_of_memory when out of memory and
return null.
If fasle, the allocation will return null immediately when out of memory.
Implementations§
source§impl AllocationOptions
impl AllocationOptions
pub(crate) fn is_default(&self) -> bool
Trait Implementations§
source§impl Clone for AllocationOptions
impl Clone for AllocationOptions
source§fn clone(&self) -> AllocationOptions
fn clone(&self) -> AllocationOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for AllocationOptions
impl Debug for AllocationOptions
source§impl Default for AllocationOptions
impl Default for AllocationOptions
The default value for AllocationOptions has the same semantics as calling Allocator::alloc
directly.
source§impl PartialEq for AllocationOptions
impl PartialEq for AllocationOptions
impl Copy for AllocationOptions
impl Eq for AllocationOptions
impl StructuralPartialEq for AllocationOptions
Auto Trait Implementations§
impl Freeze for AllocationOptions
impl RefUnwindSafe for AllocationOptions
impl Send for AllocationOptions
impl Sync for AllocationOptions
impl Unpin for AllocationOptions
impl UnwindSafe for AllocationOptions
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more