Lines Matching defs:for

3 //! The `Box<T>` type for heap allocation.
6 //! heap allocation in Rust. Boxes provide ownership for this allocation, and
52 //! for a `Cons`. By introducing a [`Box<T>`], which has a defined size, we know how
57 //! For non-zero-sized values, a [`Box`] will use the [`Global`] allocator for
60 //! [`Layout`] used with the allocator is correct for the type. More precisely,
67 //! For zero-sized values, the `Box` pointer still has to be [valid] for reads
115 //! non-null pointers. Moreover, the destructor for `Box<T>` will attempt to
117 //! is to only use `Box<T>` for pointers that originated from the global
121 //! `Box<T>` types for functions that are defined in C but invoked
127 //! # Considerations for unsafe code
133 //! The aliasing rules for `Box<T>` are the same as for `&mut T`. `Box<T>`
192 /// See the [module-level documentation](../../std/boxed/index.html) for more.
198 // on `box_free` for more details.
253 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
340 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
498 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
536 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
645 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
705 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
771 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
848 /// for (i, place) in array.iter_mut().enumerate() {
856 /// for (i, x) in big_box.iter().enumerate() {
942 /// // the (uninitialized) previous contents of `ptr`, though for this
997 /// // the (uninitialized) previous contents of `ptr`, though for this
1018 /// After calling this function, the caller is responsible for the
1032 /// for automatic cleanup:
1063 /// After calling this function, the caller is responsible for the
1077 /// for automatic cleanup:
1121 // raw pointer for the type system. Turning it directly into a raw pointer would not be
1146 /// This function is mainly useful for data that lives for the remainder of
1199 /// It's not recommended that crates add an impl like `From<Box<T>> for Pin<T>`,
1206 /// impl From<Box<()>> for Pin<Foo> {
1229 unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
1247 impl<T: Default> Default for Box<T> {
1248 /// Creates a `Box<T>`, with the `Default` value for T.
1257 impl<T> Default for Box<[T]> {
1267 impl Default for Box<str> {
1281 impl<T: Clone, A: Allocator + Clone> Clone for Box<T, A> {
1331 impl Clone for Box<str> {
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> {
1464 impl<T: ?Sized, A: Allocator> From<Box<T, A>> for Pin<Box<T, A>>
1484 /// Specialization trait used for `From<&[T]>`.
1491 impl<T: Clone> BoxFromSlice<T> for Box<[T]> {
1499 impl<T: Copy> BoxFromSlice<T> for Box<[T]> {
1513 impl<T: Clone> From<&[T]> for Box<[T]> {
1535 impl<T: Clone> From<Cow<'_, [T]>> for Box<[T]> {
1553 impl From<&str> for Box<str> {
1573 impl From<Cow<'_, str>> for Box<str> {
1607 impl<A: Allocator> From<Box<str, A>> for Box<[u8], A> {
1633 impl<T, const N: usize> From<[T; N]> for Box<[T]> {
1666 impl<T, const N: usize> TryFrom<Box<[T]>> for Box<[T; N]> {
1689 impl<T, const N: usize> TryFrom<Vec<T>> for Box<[T; N]> {
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> {
1975 /// Specialization for sized `I`s that uses `I`s implementation of `last()`
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> {}
2033 impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T, Global> {}
2037 impl<I> FromIterator<I> for Box<[I]> {
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> {
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> {
2095 * We chose this API instead of the alternative for a few reasons:
2099 * (Box<T> is the only pointer type in std for which this would be
2102 * Unpin because of trait objects, for which the structural auto
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>
2152 impl<S: ?Sized + AsyncIterator + Unpin> AsyncIterator for Box<S> {
2211 impl<'a, E: Error + 'a> From<E> for Box<dyn Error + 'a> {
2224 /// impl fmt::Display for AnError {
2230 /// impl Error for AnError {}
2244 impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync + 'a> {
2258 /// impl fmt::Display for AnError {
2264 /// impl Error for AnError {}
2266 /// unsafe impl Send for AnError {}
2268 /// unsafe impl Sync for AnError {}
2283 impl From<String> for Box<dyn Error + Send + Sync> {
2301 impl Error for StringError {
2308 impl fmt::Display for StringError {
2315 impl fmt::Debug for StringError {
2327 impl From<String> for Box<dyn Error> {
2349 impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> {
2373 impl From<&str> for Box<dyn Error> {
2395 impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a> {
2417 impl<'a> From<Cow<'a, str>> for Box<dyn Error> {
2437 impl<T: core::error::Error> core::error::Error for Box<T> {