Lines Matching full:allocator
57 //! For non-zero-sized values, a [`Box`] will use the [`Global`] allocator for
59 //! raw pointer allocated with the [`Global`] allocator, given that the
60 //! [`Layout`] used with the allocator is correct for the type. More precisely,
61 //! a `value: *mut T` that has been allocated with the [`Global`] allocator
65 //! [`Global`] allocator with [`Layout::for_value(&*value)`].
116 //! free the value with the global allocator. In general, the best practice
118 //! allocator.
172 use crate::alloc::{AllocError, Allocator, Global, Layout};
201 #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
364 impl<T, A: Allocator> Box<T, A> {
365 /// Allocates memory in the given allocator then places `x` into it.
384 A: Allocator, in new_in() argument
393 /// Allocates memory in the given allocator then places `x` into it,
412 A: Allocator, in try_new_in() argument
421 /// Constructs a new box with uninitialized contents in the provided allocator.
447 A: Allocator, in new_uninit_in() argument
458 /// Constructs a new box with uninitialized contents in the provided allocator,
484 A: Allocator, in try_new_uninit_in() argument
496 /// being filled with `0` bytes in the provided allocator.
521 A: Allocator, in new_zeroed_in() argument
533 /// being filled with `0` bytes in the provided allocator,
558 A: Allocator, in try_new_zeroed_in() argument
582 A: 'static + Allocator, in pin_in() argument
737 impl<T, A: Allocator> Box<[T], A> {
738 /// Constructs a new boxed slice with uninitialized contents in the provided allocator.
768 /// Constructs a new boxed slice with uninitialized contents in the provided allocator,
797 impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
870 impl<T, A: Allocator> Box<[mem::MaybeUninit<T>], A> {
935 /// Manually create a `Box` from scratch by using the global allocator:
959 impl<T: ?Sized, A: Allocator> Box<T, A> {
960 /// Constructs a box from a raw pointer in the given allocator.
988 /// Manually create a `Box` from scratch by using the system allocator:
992 /// use std::alloc::{Allocator, Layout, System};
1059 /// Consumes the `Box`, returning a wrapped raw pointer and the allocator.
1092 /// use std::alloc::{Allocator, Layout, System};
1129 /// Returns a reference to the underlying allocator.
1132 /// to call it as `Box::allocator(&b)` instead of `b.allocator()`. This
1137 pub const fn allocator(b: &Self) -> &A { in allocator() method
1229 unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
1281 impl<T: Clone, A: Allocator + Clone> Clone for Box<T, A> {
1340 impl<T: ?Sized + PartialEq, A: Allocator> PartialEq for Box<T, A> {
1351 impl<T: ?Sized + PartialOrd, A: Allocator> PartialOrd for Box<T, A> {
1374 impl<T: ?Sized + Ord, A: Allocator> Ord for Box<T, A> {
1381 impl<T: ?Sized + Eq, A: Allocator> Eq for Box<T, A> {}
1384 impl<T: ?Sized + Hash, A: Allocator> Hash for Box<T, A> {
1391 impl<T: ?Sized + Hasher, A: Allocator> Hasher for Box<T, A> {
1464 impl<T: ?Sized, A: Allocator> From<Box<T, A>> for Pin<Box<T, A>>
1607 impl<A: Allocator> From<Box<str, A>> for Box<[u8], A> {
1654 unsafe fn boxed_slice_as_array_unchecked<T, A: Allocator, const N: usize>( in boxed_slice_as_array_unchecked() argument
1660 // SAFETY: Pointer and allocator came from an existing box,
1720 impl<A: Allocator> Box<dyn Any, A> {
1779 impl<A: Allocator> Box<dyn Any + Send, A> {
1838 impl<A: Allocator> Box<dyn Any + Send + Sync, A> {
1899 impl<T: fmt::Display + ?Sized, A: Allocator> fmt::Display for Box<T, A> {
1906 impl<T: fmt::Debug + ?Sized, A: Allocator> fmt::Debug for Box<T, A> {
1913 impl<T: ?Sized, A: Allocator> fmt::Pointer for Box<T, A> {
1923 impl<T: ?Sized, A: Allocator> Deref for Box<T, A> {
1932 impl<T: ?Sized, A: Allocator> DerefMut for Box<T, A> {
1939 impl<T: ?Sized, A: Allocator> Receiver for Box<T, A> {}
1942 impl<I: Iterator + ?Sized, A: Allocator> Iterator for Box<I, A> {
1963 impl<I: Iterator + ?Sized, A: Allocator> BoxIter for Box<I, A> {
1978 impl<I: Iterator, A: Allocator> BoxIter for Box<I, A> {
1985 impl<I: DoubleEndedIterator + ?Sized, A: Allocator> DoubleEndedIterator for Box<I, A> {
1994 impl<I: ExactSizeIterator + ?Sized, A: Allocator> ExactSizeIterator for Box<I, A> {
2004 impl<I: FusedIterator + ?Sized, A: Allocator> FusedIterator for Box<I, A> {}
2007 impl<Args: Tuple, F: FnOnce<Args> + ?Sized, A: Allocator> FnOnce<Args> for Box<F, A> {
2016 impl<Args: Tuple, F: FnMut<Args> + ?Sized, A: Allocator> FnMut<Args> for Box<F, A> {
2023 impl<Args: Tuple, F: Fn<Args> + ?Sized, A: Allocator> Fn<Args> for Box<F, A> {
2030 impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> for Box<T, A> {}
2045 impl<T: Clone, A: Allocator + Clone> Clone for Box<[T], A> {
2047 let alloc = Box::allocator(self).clone(); in clone()
2061 impl<T: ?Sized, A: Allocator> borrow::Borrow<T> for Box<T, A> {
2068 impl<T: ?Sized, A: Allocator> borrow::BorrowMut<T> for Box<T, A> {
2075 impl<T: ?Sized, A: Allocator> AsRef<T> for Box<T, A> {
2082 impl<T: ?Sized, A: Allocator> AsMut<T> for Box<T, A> {
2111 impl<T: ?Sized, A: Allocator> Unpin for Box<T, A> where A: 'static {}
2114 impl<G: ?Sized + Generator<R> + Unpin, R, A: Allocator> Generator<R> for Box<G, A>
2127 impl<G: ?Sized + Generator<R>, R, A: Allocator> Generator<R> for Pin<Box<G, A>>
2140 impl<F: ?Sized + Future + Unpin, A: Allocator> Future for Box<F, A>