Lines Matching refs:T

200     T: ?Sized,
202 >(Unique<T>, A);
204 impl<T> Box<T> {
219 pub fn new(x: T) -> Self { in new()
246 pub fn new_uninit() -> Box<mem::MaybeUninit<T>> { in new_uninit()
272 pub fn new_zeroed() -> Box<mem::MaybeUninit<T>> { in new_zeroed()
287 pub fn pin(x: T) -> Pin<Box<T>> { in pin() argument
306 pub fn try_new(x: T) -> Result<Self, AllocError> { in try_new()
333 pub fn try_new_uninit() -> Result<Box<mem::MaybeUninit<T>>, AllocError> { in try_new_uninit()
359 pub fn try_new_zeroed() -> Result<Box<mem::MaybeUninit<T>>, AllocError> { in try_new_zeroed()
364 impl<T, A: Allocator> Box<T, A> {
382 pub fn new_in(x: T, alloc: A) -> Self in new_in() argument
410 pub fn try_new_in(x: T, alloc: A) -> Result<Self, AllocError> in try_new_in() argument
445 pub fn new_uninit_in(alloc: A) -> Box<mem::MaybeUninit<T>, A> in new_uninit_in() argument
449 let layout = Layout::new::<mem::MaybeUninit<T>>(); in new_uninit_in()
482 pub fn try_new_uninit_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError> in try_new_uninit_in() argument
486 let ptr = if T::IS_ZST { in try_new_uninit_in()
489 let layout = Layout::new::<mem::MaybeUninit<T>>(); in try_new_uninit_in()
519 pub fn new_zeroed_in(alloc: A) -> Box<mem::MaybeUninit<T>, A> in new_zeroed_in() argument
523 let layout = Layout::new::<mem::MaybeUninit<T>>(); in new_zeroed_in()
556 pub fn try_new_zeroed_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError> in try_new_zeroed_in() argument
560 let ptr = if T::IS_ZST { in try_new_zeroed_in()
563 let layout = Layout::new::<mem::MaybeUninit<T>>(); in try_new_zeroed_in()
580 pub fn pin_in(x: T, alloc: A) -> Pin<Self> in pin_in() argument
591 pub fn into_boxed_slice(boxed: Self) -> Box<[T], A> { in into_boxed_slice() argument
593 unsafe { Box::from_raw_in(raw as *mut [T; 1], alloc) } in into_boxed_slice()
609 pub fn into_inner(boxed: Self) -> T { in into_inner() argument
614 impl<T> Box<[T]> {
638 pub fn new_uninit_slice(len: usize) -> Box<[mem::MaybeUninit<T>]> { in new_uninit_slice() argument
663 pub fn new_zeroed_slice(len: usize) -> Box<[mem::MaybeUninit<T>]> { in new_zeroed_slice() argument
689 pub fn try_new_uninit_slice(len: usize) -> Result<Box<[mem::MaybeUninit<T>]>, AllocError> { in try_new_uninit_slice() argument
690 let ptr = if T::IS_ZST || len == 0 { in try_new_uninit_slice()
693 let layout = match Layout::array::<mem::MaybeUninit<T>>(len) { in try_new_uninit_slice()
723 pub fn try_new_zeroed_slice(len: usize) -> Result<Box<[mem::MaybeUninit<T>]>, AllocError> { in try_new_zeroed_slice() argument
724 let ptr = if T::IS_ZST || len == 0 { in try_new_zeroed_slice()
727 let layout = match Layout::array::<mem::MaybeUninit<T>>(len) { in try_new_zeroed_slice()
737 impl<T, A: Allocator> Box<[T], A> {
764 pub fn new_uninit_slice_in(len: usize, alloc: A) -> Box<[mem::MaybeUninit<T>], A> { in new_uninit_slice_in() argument
792 pub fn new_zeroed_slice_in(len: usize, alloc: A) -> Box<[mem::MaybeUninit<T>], A> { in new_zeroed_slice_in() argument
797 impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
828 pub unsafe fn assume_init(self) -> Box<T, A> { in assume_init() argument
830 unsafe { Box::from_raw_in(raw as *mut T, alloc) } in assume_init()
862 pub fn write(mut boxed: Self, value: T) -> Box<T, A> { in write() argument
870 impl<T, A: Allocator> Box<[mem::MaybeUninit<T>], A> {
903 pub unsafe fn assume_init(self) -> Box<[T], A> { in assume_init() argument
905 unsafe { Box::from_raw_in(raw as *mut [T], alloc) } in assume_init()
909 impl<T: ?Sized> Box<T> {
954 pub unsafe fn from_raw(raw: *mut T) -> Self { in from_raw()
959 impl<T: ?Sized, A: Allocator> Box<T, A> {
1010 pub const unsafe fn from_raw_in(raw: *mut T, alloc: A) -> Self { in from_raw_in() argument
1055 pub fn into_raw(b: Self) -> *mut T { in into_raw() argument
1107 pub fn into_raw_with_allocator(b: Self) -> (*mut T, A) { in into_raw_with_allocator() argument
1119 pub fn into_unique(b: Self) -> (Unique<T>, A) { in into_unique() argument
1178 pub fn leak<'a>(b: Self) -> &'a mut T in leak()
1229 unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
1247 impl<T: Default> Default for Box<T> {
1251 Box::new(T::default()) in default()
1257 impl<T> Default for Box<[T]> {
1260 let ptr: Unique<[T]> = Unique::<[T; 0]>::dangling(); in default()
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> {
1444 impl<T> From<T> for Box<T> {
1458 fn from(t: T) -> Self { in from()
1464 impl<T: ?Sized, A: Allocator> From<Box<T, A>> for Pin<Box<T, A>>
1479 fn from(boxed: Box<T, A>) -> Self { in from() argument
1486 trait BoxFromSlice<T> {
1487 fn from_slice(slice: &[T]) -> Self; in from_slice()
1491 impl<T: Clone> BoxFromSlice<T> for Box<[T]> {
1493 default fn from_slice(slice: &[T]) -> Self { in from_slice()
1499 impl<T: Copy> BoxFromSlice<T> for Box<[T]> {
1501 fn from_slice(slice: &[T]) -> Self { in from_slice()
1513 impl<T: Clone> From<&[T]> for Box<[T]> {
1528 fn from(slice: &[T]) -> Box<[T]> { in from() argument
1529 <Self as BoxFromSlice<T>>::from_slice(slice) in from()
1535 impl<T: Clone> From<Cow<'_, [T]>> for Box<[T]> {
1543 fn from(cow: Cow<'_, [T]>) -> Box<[T]> { in from() argument
1633 impl<T, const N: usize> From<[T; N]> for Box<[T]> {
1644 fn from(array: [T; N]) -> Box<[T]> { in from() argument
1654 unsafe fn boxed_slice_as_array_unchecked<T, A: Allocator, const N: usize>( in boxed_slice_as_array_unchecked() argument
1655 boxed_slice: Box<[T], A>, in boxed_slice_as_array_unchecked() argument
1656 ) -> Box<[T; N], A> { in boxed_slice_as_array_unchecked()
1662 unsafe { Box::from_raw_in(ptr as *mut [T; N], alloc) }
1666 impl<T, const N: usize> TryFrom<Box<[T]>> for Box<[T; N]> {
1667 type Error = Box<[T]>;
1678 fn try_from(boxed_slice: Box<[T]>) -> Result<Self, Self::Error> { in try_from()
1689 impl<T, const N: usize> TryFrom<Vec<T>> for Box<[T; N]> {
1690 type Error = Vec<T>;
1710 fn try_from(vec: Vec<T>) -> Result<Self, Self::Error> { in try_from()
1740 pub fn downcast<T: Any>(self) -> Result<Box<T, A>, Self> { in downcast() argument
1741 if self.is::<T>() { unsafe { Ok(self.downcast_unchecked::<T>()) } } else { Err(self) } in downcast()
1770 pub unsafe fn downcast_unchecked<T: Any>(self) -> Box<T, A> { in downcast_unchecked() argument
1771 debug_assert!(self.is::<T>()); in downcast_unchecked()
1774 Box::from_raw_in(raw as *mut T, alloc) in downcast_unchecked()
1799 pub fn downcast<T: Any>(self) -> Result<Box<T, A>, Self> { in downcast() argument
1800 if self.is::<T>() { unsafe { Ok(self.downcast_unchecked::<T>()) } } else { Err(self) } in downcast()
1829 pub unsafe fn downcast_unchecked<T: Any>(self) -> Box<T, A> { in downcast_unchecked() argument
1830 debug_assert!(self.is::<T>()); in downcast_unchecked()
1833 Box::from_raw_in(raw as *mut T, alloc) in downcast_unchecked()
1858 pub fn downcast<T: Any>(self) -> Result<Box<T, A>, Self> { in downcast() argument
1859 if self.is::<T>() { unsafe { Ok(self.downcast_unchecked::<T>()) } } else { Err(self) } in downcast()
1888 pub unsafe fn downcast_unchecked<T: Any>(self) -> Box<T, A> { in downcast_unchecked() argument
1889 debug_assert!(self.is::<T>()); in downcast_unchecked()
1893 Box::from_raw_in(raw as *mut T, alloc) in downcast_unchecked()
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> {
1917 let ptr: *const T = &**self; in fmt() constant
1923 impl<T: ?Sized, A: Allocator> Deref for Box<T, A> {
1924 type Target = T;
1926 fn deref(&self) -> &T { in deref() argument
1932 impl<T: ?Sized, A: Allocator> DerefMut for Box<T, A> {
1933 fn deref_mut(&mut self) -> &mut T { in deref_mut() argument
1939 impl<T: ?Sized, A: Allocator> Receiver for Box<T, A> {}
1967 fn some<T>(_: Option<T>, x: T) -> Option<T> { in last() argument
2030 impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> for Box<T, A> {}
2033 impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T, Global> {}
2038 fn from_iter<T: IntoIterator<Item = I>>(iter: T) -> Self { in from_iter()
2045 impl<T: Clone, A: Allocator + Clone> Clone for Box<[T], A> {
2061 impl<T: ?Sized, A: Allocator> borrow::Borrow<T> for Box<T, A> {
2062 fn borrow(&self) -> &T { in borrow() argument
2068 impl<T: ?Sized, A: Allocator> borrow::BorrowMut<T> for Box<T, A> {
2069 fn borrow_mut(&mut self) -> &mut T { in borrow_mut() argument
2075 impl<T: ?Sized, A: Allocator> AsRef<T> for Box<T, A> {
2076 fn as_ref(&self) -> &T { in as_ref() argument
2082 impl<T: ?Sized, A: Allocator> AsMut<T> for Box<T, A> {
2083 fn as_mut(&mut self) -> &mut T { in as_mut() argument
2111 impl<T: ?Sized, A: Allocator> Unpin for Box<T, A> where A: 'static {}
2169 pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<dyn Error>> { in downcast() argument
2170 if self.is::<T>() { in downcast()
2173 Ok(Box::from_raw(raw as *mut T)) in downcast()
2186 pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<dyn Error + Send>> { in downcast() argument
2200 pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<Self>> { in downcast() argument
2437 impl<T: core::error::Error> core::error::Error for Box<T> {