Skip to main content

AllocatorNightly

Trait AllocatorNightly 

Source
pub trait AllocatorNightly: Allocator { }
🔬This is a nightly-only experimental API. (allocator_ext #163177)
Expand description

Allocator marker trait that is only implemented stably for Global.

Enabling feature(allocator_ext) causes this trait to be implemented for all allocators in std, and for any downstream allocator that explicitly implements it.

This trait is used as a bound whenever a function constructing a type with an #[unstable] A: Allocator = Global parameter may be callable for A != Global.

This is to prevent stable code from e.g. constructing Arc<T, NotGlobal> using the From<Box<T, A>> for Arc<T, A> impl.

Note that this trait will be removed in the future, but downstream allocators should still feel free to implement it on nightly, to allow their allocator to be used with all unstable allocator APIs.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<A: Allocator + ?Sized> AllocatorNightly for &A

This trait impl is unstable and only usable on nightly with feature(allocator_ext).

Source§

impl<A: Allocator + ?Sized> AllocatorNightly for &mut A

This trait impl is unstable and only usable on nightly with feature(allocator_ext).

Source§

impl<P> AllocatorNightly for Pin<P>
where P: Deref<Target: Allocator> + PinSafePointer,

This trait impl is unstable and only usable on nightly with feature(allocator_ext).