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 layout = Layout::new::<mem::MaybeUninit<T>>(); in try_new_uninit_in()
515 pub fn new_zeroed_in(alloc: A) -> Box<mem::MaybeUninit<T>, A> in new_zeroed_in() argument
519 let layout = Layout::new::<mem::MaybeUninit<T>>(); in new_zeroed_in()
552 pub fn try_new_zeroed_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError> in try_new_zeroed_in() argument
556 let layout = Layout::new::<mem::MaybeUninit<T>>(); in try_new_zeroed_in()
572 pub fn pin_in(x: T, alloc: A) -> Pin<Self> in pin_in() argument
583 pub fn into_boxed_slice(boxed: Self) -> Box<[T], A> { in into_boxed_slice() argument
585 unsafe { Box::from_raw_in(raw as *mut [T; 1], alloc) } in into_boxed_slice()
601 pub fn into_inner(boxed: Self) -> T { in into_inner() argument
606 impl<T> Box<[T]> {
630 pub fn new_uninit_slice(len: usize) -> Box<[mem::MaybeUninit<T>]> { in new_uninit_slice() argument
655 pub fn new_zeroed_slice(len: usize) -> Box<[mem::MaybeUninit<T>]> { in new_zeroed_slice() argument
681 pub fn try_new_uninit_slice(len: usize) -> Result<Box<[mem::MaybeUninit<T>]>, AllocError> { in try_new_uninit_slice() argument
683 let layout = match Layout::array::<mem::MaybeUninit<T>>(len) { in try_new_uninit_slice()
713 pub fn try_new_zeroed_slice(len: usize) -> Result<Box<[mem::MaybeUninit<T>]>, AllocError> { in try_new_zeroed_slice() argument
715 let layout = match Layout::array::<mem::MaybeUninit<T>>(len) { in try_new_zeroed_slice()
725 impl<T, A: Allocator> Box<[T], A> {
752 pub fn new_uninit_slice_in(len: usize, alloc: A) -> Box<[mem::MaybeUninit<T>], A> { in new_uninit_slice_in() argument
780 pub fn new_zeroed_slice_in(len: usize, alloc: A) -> Box<[mem::MaybeUninit<T>], A> { in new_zeroed_slice_in() argument
785 impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
816 pub unsafe fn assume_init(self) -> Box<T, A> { in assume_init() argument
818 unsafe { Box::from_raw_in(raw as *mut T, alloc) } in assume_init()
850 pub fn write(mut boxed: Self, value: T) -> Box<T, A> { in write() argument
858 impl<T, A: Allocator> Box<[mem::MaybeUninit<T>], A> {
891 pub unsafe fn assume_init(self) -> Box<[T], A> { in assume_init() argument
893 unsafe { Box::from_raw_in(raw as *mut [T], alloc) } in assume_init()
897 impl<T: ?Sized> Box<T> {
942 pub unsafe fn from_raw(raw: *mut T) -> Self { in from_raw()
947 impl<T: ?Sized, A: Allocator> Box<T, A> {
998 pub const unsafe fn from_raw_in(raw: *mut T, alloc: A) -> Self { in from_raw_in() argument
1043 pub fn into_raw(b: Self) -> *mut T { in into_raw() argument
1095 pub fn into_raw_with_allocator(b: Self) -> (*mut T, A) { in into_raw_with_allocator() argument
1107 pub fn into_unique(b: Self) -> (Unique<T>, A) { in into_unique() argument
1166 pub fn leak<'a>(b: Self) -> &'a mut T in leak()
1217 unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
1225 impl<T: Default> Default for Box<T> {
1229 Box::new(T::default()) in default()
1235 impl<T> Default for Box<[T]> {
1238 let ptr: Unique<[T]> = Unique::<[T; 0]>::dangling(); in default()
1259 impl<T: Clone, A: Allocator + Clone> Clone for Box<T, A> {
1318 impl<T: ?Sized + PartialEq, A: Allocator> PartialEq for Box<T, A> {
1329 impl<T: ?Sized + PartialOrd, A: Allocator> PartialOrd for Box<T, A> {
1352 impl<T: ?Sized + Ord, A: Allocator> Ord for Box<T, A> {
1359 impl<T: ?Sized + Eq, A: Allocator> Eq for Box<T, A> {}
1362 impl<T: ?Sized + Hash, A: Allocator> Hash for Box<T, A> {
1369 impl<T: ?Sized + Hasher, A: Allocator> Hasher for Box<T, A> {
1422 impl<T> From<T> for Box<T> {
1436 fn from(t: T) -> Self { in from()
1442 impl<T: ?Sized, A: Allocator> From<Box<T, A>> for Pin<Box<T, A>>
1457 fn from(boxed: Box<T, A>) -> Self { in from() argument
1464 trait BoxFromSlice<T> {
1465 fn from_slice(slice: &[T]) -> Self; in from_slice()
1469 impl<T: Clone> BoxFromSlice<T> for Box<[T]> {
1471 default fn from_slice(slice: &[T]) -> Self { in from_slice()
1477 impl<T: Copy> BoxFromSlice<T> for Box<[T]> {
1479 fn from_slice(slice: &[T]) -> Self { in from_slice()
1491 impl<T: Clone> From<&[T]> for Box<[T]> {
1506 fn from(slice: &[T]) -> Box<[T]> { in from() argument
1507 <Self as BoxFromSlice<T>>::from_slice(slice) in from()
1513 impl<T: Clone> From<Cow<'_, [T]>> for Box<[T]> {
1521 fn from(cow: Cow<'_, [T]>) -> Box<[T]> { in from() argument
1611 impl<T, const N: usize> From<[T; N]> for Box<[T]> {
1622 fn from(array: [T; N]) -> Box<[T]> { in from() argument
1632 unsafe fn boxed_slice_as_array_unchecked<T, A: Allocator, const N: usize>( in boxed_slice_as_array_unchecked() argument
1633 boxed_slice: Box<[T], A>, in boxed_slice_as_array_unchecked() argument
1634 ) -> Box<[T; N], A> { in boxed_slice_as_array_unchecked()
1640 unsafe { Box::from_raw_in(ptr as *mut [T; N], alloc) }
1644 impl<T, const N: usize> TryFrom<Box<[T]>> for Box<[T; N]> {
1645 type Error = Box<[T]>;
1656 fn try_from(boxed_slice: Box<[T]>) -> Result<Self, Self::Error> { in try_from()
1667 impl<T, const N: usize> TryFrom<Vec<T>> for Box<[T; N]> {
1668 type Error = Vec<T>;
1688 fn try_from(vec: Vec<T>) -> Result<Self, Self::Error> { in try_from()
1718 pub fn downcast<T: Any>(self) -> Result<Box<T, A>, Self> { in downcast() argument
1719 if self.is::<T>() { unsafe { Ok(self.downcast_unchecked::<T>()) } } else { Err(self) } in downcast()
1748 pub unsafe fn downcast_unchecked<T: Any>(self) -> Box<T, A> { in downcast_unchecked() argument
1749 debug_assert!(self.is::<T>()); in downcast_unchecked()
1752 Box::from_raw_in(raw as *mut T, alloc) in downcast_unchecked()
1777 pub fn downcast<T: Any>(self) -> Result<Box<T, A>, Self> { in downcast() argument
1778 if self.is::<T>() { unsafe { Ok(self.downcast_unchecked::<T>()) } } else { Err(self) } in downcast()
1807 pub unsafe fn downcast_unchecked<T: Any>(self) -> Box<T, A> { in downcast_unchecked() argument
1808 debug_assert!(self.is::<T>()); in downcast_unchecked()
1811 Box::from_raw_in(raw as *mut T, alloc) in downcast_unchecked()
1836 pub fn downcast<T: Any>(self) -> Result<Box<T, A>, Self> { in downcast() argument
1837 if self.is::<T>() { unsafe { Ok(self.downcast_unchecked::<T>()) } } else { Err(self) } in downcast()
1866 pub unsafe fn downcast_unchecked<T: Any>(self) -> Box<T, A> { in downcast_unchecked() argument
1867 debug_assert!(self.is::<T>()); in downcast_unchecked()
1871 Box::from_raw_in(raw as *mut T, alloc) in downcast_unchecked()
1877 impl<T: fmt::Display + ?Sized, A: Allocator> fmt::Display for Box<T, A> {
1884 impl<T: fmt::Debug + ?Sized, A: Allocator> fmt::Debug for Box<T, A> {
1891 impl<T: ?Sized, A: Allocator> fmt::Pointer for Box<T, A> {
1895 let ptr: *const T = &**self; in fmt()
1901 impl<T: ?Sized, A: Allocator> Deref for Box<T, A> {
1902 type Target = T;
1904 fn deref(&self) -> &T { in deref() argument
1910 impl<T: ?Sized, A: Allocator> DerefMut for Box<T, A> {
1911 fn deref_mut(&mut self) -> &mut T { in deref_mut() argument
1917 impl<T: ?Sized, A: Allocator> Receiver for Box<T, A> {}
1945 fn some<T>(_: Option<T>, x: T) -> Option<T> { in last() argument
2008 impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> for Box<T, A> {}
2011 impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T, Global> {}
2016 fn from_iter<T: IntoIterator<Item = I>>(iter: T) -> Self { in from_iter()
2023 impl<T: Clone, A: Allocator + Clone> Clone for Box<[T], A> {
2039 impl<T: ?Sized, A: Allocator> borrow::Borrow<T> for Box<T, A> {
2040 fn borrow(&self) -> &T { in borrow() argument
2046 impl<T: ?Sized, A: Allocator> borrow::BorrowMut<T> for Box<T, A> {
2047 fn borrow_mut(&mut self) -> &mut T { in borrow_mut() argument
2053 impl<T: ?Sized, A: Allocator> AsRef<T> for Box<T, A> {
2054 fn as_ref(&self) -> &T { in as_ref() argument
2060 impl<T: ?Sized, A: Allocator> AsMut<T> for Box<T, A> {
2061 fn as_mut(&mut self) -> &mut T { in as_mut() argument
2089 impl<T: ?Sized, A: Allocator> Unpin for Box<T, A> where A: 'static {}
2147 pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<dyn Error>> { in downcast() argument
2148 if self.is::<T>() { in downcast()
2151 Ok(Box::from_raw(raw as *mut T)) in downcast()
2164 pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<dyn Error + Send>> { in downcast() argument
2178 pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<Self>> { in downcast() argument
2415 impl<T: core::error::Error> core::error::Error for Box<T> {