Skip to main content

Forget

Trait Forget 

Source
pub unsafe auto trait Forget { }
🔬This is a nightly-only experimental API. (forget_trait)
Expand description

Marks a type as “forgettable”, giving it the ability to be passed to mem::forget, and other apis that may forget values. A notable example of forgetting values, though slightly less obvious than mem::forget, is using a value inside an Rc. Values inside Rcs or Arcs can end up being forgotten as the result of a reference cycle.

By default, all types are assumed to be Forget. Similar to Sized, the syntax T: ?Forget can be used to relax this bound for some type T. However, Forget bounds are implicitly added in all cases unless explicitly opted out of - notably, in trait definitions and associated types. If the forget_trait feature is enabled, these can similarly be opted out of:

ⓘ
#![feature(forget_trait)]
use std::marker::Forget;

trait Foo: ?Forget {
    type Bar: ?Forget;
}

The explicit goal of mem::forget is not to run the destructor of a value (i.e. its implementation of Drop). As a dual to this, since ?Forget types cannot be forgotten, the destructors of ?Forget types are guaranteed to be run.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Auto implementors§

§

impl Forget for Abi

§

impl Forget for AddrParseError

§

impl Forget for maybe_std::mem::Alignment

§

impl Forget for maybe_std::fmt::Alignment

§

impl Forget for AllocError

§

impl Forget for AsciiChar

§

impl Forget for Assume

§

impl Forget for AtomicOrdering

§

impl Forget for BasicBlock

§

impl Forget for BorrowError

§

impl Forget for BorrowMutError

§

impl Forget for ByteStr

§

impl Forget for CStr

§

impl Forget for CastKind

§

impl Forget for CharCase

§

impl Forget for CharTryFromError

§

impl Forget for Const

§

impl Forget for CpuidResult

§

impl Forget for DebugAsHex

§

impl Forget for DecodeUtf16Error

§

impl Forget for DisplaySeconds

§

impl Forget for Duration

§

impl Forget for DynTrait

§

impl Forget for DynTraitPredicate

§

impl Forget for maybe_std::io::Empty

§

impl Forget for maybe_std::io::Error

§

impl Forget for maybe_std::fmt::Error

§

impl Forget for ErrorKind

§

impl Forget for maybe_std::char::EscapeDebug

§

impl Forget for maybe_std::ascii::EscapeDefault

§

impl Forget for maybe_std::char::EscapeDefault

§

impl Forget for maybe_std::char::EscapeUnicode

§

impl Forget for FieldId

§

impl Forget for FloatErrorKind

§

impl Forget for FnPtr

§

impl Forget for FormattingOptions

§

impl Forget for FpCategory

§

impl Forget for FromBytesUntilNulError

§

impl Forget for FromBytesWithNulError

§

impl Forget for Generic

§

impl Forget for GenericType

§

impl Forget for GetDisjointMutError

§

impl Forget for IntErrorKind

§

impl Forget for IpAddr

§

impl Forget for Ipv4Addr

§

impl Forget for Ipv6Addr

§

impl Forget for Ipv6MulticastScope

§

impl Forget for Last

§

impl Forget for LaunchError

§

impl Forget for Layout

§

impl Forget for LayoutError

§

impl Forget for Lifetime

§

impl Forget for LocalWaker

§

impl Forget for Locality

§

impl Forget for OneSidedRangeBound

§

impl Forget for maybe_std::cmp::Ordering

§

impl Forget for maybe_std::sync::atomic::Ordering

§

impl Forget for ParseBoolError

§

impl Forget for ParseCharError

§

impl Forget for ParseFloatError

§

impl Forget for ParseIntError

§

impl Forget for PhantomPinned

§

impl Forget for PointerCoercion

§

impl Forget for RangeFull

§

impl Forget for RawWaker

§

impl Forget for RawWakerVTable

§

impl Forget for maybe_std::io::Repeat

§

impl Forget for ReturnToArg

§

impl Forget for Safety

§

impl Forget for SearchStep

§

impl Forget for SeekFrom

§

impl Forget for Sign

§

impl Forget for SimdAlign

§

impl Forget for Sink

§

impl Forget for SipHasher

§

impl Forget for SocketAddr

§

impl Forget for SocketAddrV4

§

impl Forget for SocketAddrV6

§

impl Forget for Str

§

impl Forget for ToCasefold

§

impl Forget for ToLowercase

§

impl Forget for ToTitlecase

§

impl Forget for ToUppercase

§

impl Forget for Trait

§

impl Forget for TryFromCharError

§

impl Forget for TryFromFloatSecsError

§

impl Forget for TryFromIntError

§

impl Forget for TryFromSliceError

§

impl Forget for Type

§

impl Forget for TypeId

§

impl Forget for TypeKind

§

impl Forget for UnwindActionArg

§

impl Forget for UnwindTerminateReason

§

impl Forget for Utf8Error

§

impl Forget for VariantId

§

impl Forget for Waker

§

impl Forget for __m128

§

impl Forget for __m256

§

impl Forget for __m512

§

impl Forget for __m128bh

§

impl Forget for __m128d

§

impl Forget for __m128h

§

impl Forget for __m128i

§

impl Forget for __m256bh

§

impl Forget for __m256d

§

impl Forget for __m256h

§

impl Forget for __m256i

§

impl Forget for __m512bh

§

impl Forget for __m512d

§

impl Forget for __m512h

§

impl Forget for __m512i

§

impl Forget for __tile1024i

§

impl Forget for bf16

§

impl Forget for c_void

§

impl Forget for f16b

§

impl Forget for x87_f80

§

impl<'a, 'b, const N: usize> Forget for CharArrayRefSearcher<'a, 'b, N>

§

impl<'a, 'b> Forget for CharSliceSearcher<'a, 'b>

§

impl<'a, 'b> Forget for DebugList<'a, 'b>

§

impl<'a, 'b> Forget for DebugMap<'a, 'b>

§

impl<'a, 'b> Forget for DebugSet<'a, 'b>

§

impl<'a, 'b> Forget for DebugStruct<'a, 'b>

§

impl<'a, 'b> Forget for DebugTuple<'a, 'b>

§

impl<'a, 'b> Forget for StrSearcher<'a, 'b>

§

impl<'a, A> Forget for maybe_std::option::Iter<'a, A>

§

impl<'a, A> Forget for maybe_std::option::IterMut<'a, A>

§

impl<'a, F> Forget for CharPredicateSearcher<'a, F>

§

impl<'a, I> Forget for ByRefSized<'a, I>

§

impl<'a, P> Forget for MatchIndices<'a, P>

§

impl<'a, P> Forget for Matches<'a, P>

§

impl<'a, P> Forget for RMatchIndices<'a, P>

§

impl<'a, P> Forget for RMatches<'a, P>

§

impl<'a, P> Forget for maybe_std::str::RSplit<'a, P>

§

impl<'a, P> Forget for maybe_std::str::RSplitN<'a, P>

§

impl<'a, P> Forget for RSplitTerminator<'a, P>

§

impl<'a, P> Forget for maybe_std::str::Split<'a, P>

§

impl<'a, P> Forget for maybe_std::str::SplitInclusive<'a, P>

§

impl<'a, P> Forget for maybe_std::str::SplitN<'a, P>

§

impl<'a, P> Forget for SplitTerminator<'a, P>

§

impl<'a, T, P> Forget for ChunkBy<'a, T, P>

§

impl<'a, T, P> Forget for ChunkByMut<'a, T, P>

§

impl<'a, T, P> Forget for maybe_std::slice::RSplit<'a, T, P>

§

impl<'a, T, P> Forget for RSplitMut<'a, T, P>

§

impl<'a, T, P> Forget for maybe_std::slice::RSplitN<'a, T, P>

§

impl<'a, T, P> Forget for RSplitNMut<'a, T, P>

§

impl<'a, T, P> Forget for maybe_std::slice::Split<'a, T, P>

§

impl<'a, T, P> Forget for maybe_std::slice::SplitInclusive<'a, T, P>

§

impl<'a, T, P> Forget for SplitInclusiveMut<'a, T, P>

§

impl<'a, T, P> Forget for SplitMut<'a, T, P>

§

impl<'a, T, P> Forget for maybe_std::slice::SplitN<'a, T, P>

§

impl<'a, T, P> Forget for SplitNMut<'a, T, P>

§

impl<'a, T, S> Forget for Region<'a, T, S>

§

impl<'a, T, const N: usize> Forget for ArrayWindows<'a, T, N>

§

impl<'a, T> Forget for BorrowedCursor<'a, T>

§

impl<'a, T> Forget for Chunks<'a, T>

§

impl<'a, T> Forget for ChunksExact<'a, T>

§

impl<'a, T> Forget for ChunksExactMut<'a, T>

§

impl<'a, T> Forget for ChunksMut<'a, T>

§

impl<'a, T> Forget for maybe_std::result::Iter<'a, T>

§

impl<'a, T> Forget for maybe_std::slice::Iter<'a, T>

§

impl<'a, T> Forget for maybe_std::result::IterMut<'a, T>

§

impl<'a, T> Forget for maybe_std::slice::IterMut<'a, T>

§

impl<'a, T> Forget for RChunks<'a, T>

§

impl<'a, T> Forget for RChunksExact<'a, T>

§

impl<'a, T> Forget for RChunksExactMut<'a, T>

§

impl<'a, T> Forget for RChunksMut<'a, T>

§

impl<'a, T> Forget for RawRegion<'a, T>

§

impl<'a, T> Forget for Windows<'a, T>

§

impl<'a, const N: usize> Forget for CharArraySearcher<'a, N>

§

impl<'a> Forget for Arguments<'a>

§

impl<'a> Forget for maybe_std::ffi::c_str::Bytes<'a>

§

impl<'a> Forget for maybe_std::str::Bytes<'a>

§

impl<'a> Forget for CharIndices<'a>

§

impl<'a> Forget for CharSearcher<'a>

§

impl<'a> Forget for Chars<'a>

§

impl<'a> Forget for Context<'a>

§

impl<'a> Forget for ContextBuilder<'a>

§

impl<'a> Forget for Display<'a>

§

impl<'a> Forget for EncodeUtf16<'a>

§

impl<'a> Forget for EscapeAscii<'a>

§

impl<'a> Forget for maybe_std::str::EscapeDebug<'a>

§

impl<'a> Forget for maybe_std::str::EscapeDefault<'a>

§

impl<'a> Forget for maybe_std::str::EscapeUnicode<'a>

§

impl<'a> Forget for Formatter<'a>

§

impl<'a> Forget for IoSlice<'a>

§

impl<'a> Forget for IoSliceMut<'a>

§

impl<'a> Forget for Lines<'a>

§

impl<'a> Forget for LinesAny<'a>

§

impl<'a> Forget for Location<'a>

§

impl<'a> Forget for PanicInfo<'a>

§

impl<'a> Forget for PanicMessage<'a>

§

impl<'a> Forget for PhantomContravariantLifetime<'a>

§

impl<'a> Forget for PhantomCovariantLifetime<'a>

§

impl<'a> Forget for PhantomInvariantLifetime<'a>

§

impl<'a> Forget for Request<'a>

§

impl<'a> Forget for Source<'a>

§

impl<'a> Forget for maybe_std::slice::SplitAsciiWhitespace<'a>

§

impl<'a> Forget for maybe_std::str::SplitAsciiWhitespace<'a>

§

impl<'a> Forget for SplitWhitespace<'a>

§

impl<'a> Forget for Utf8Chunk<'a>

§

impl<'a> Forget for Utf8Chunks<'a>

§

impl<'a> Forget for Utf8Pattern<'a>

§

impl<'a> Forget for VaList<'a>

§

impl<'b, T> Forget for Ref<'b, T>
where T: ?Sized,

§

impl<'b, T> Forget for RefMut<'b, T>
where T: ?Sized,

§

impl<'data, T> Forget for BorrowedBuf<'data, T>

§

impl<A, B> Forget for maybe_std::iter::Chain<A, B>

§

impl<A, B> Forget for Zip<A, B>

§

impl<A> Forget for maybe_std::option::IntoIter<A>

§

impl<A> Forget for OptionFlatten<A>

§

impl<A> Forget for RangeFromIter<A>

§

impl<A> Forget for RangeInclusiveIter<A>

§

impl<A> Forget for RangeIter<A>

§

impl<A> Forget for maybe_std::iter::Repeat<A>

§

impl<A> Forget for RepeatN<A>

§

impl<B, C> Forget for ControlFlow<B, C>

§

impl<Dyn> Forget for DynMetadata<Dyn>
where Dyn: ?Sized,

§

impl<F> Forget for maybe_std::iter::FromFn<F>

§

impl<F> Forget for maybe_std::fmt::FromFn<F>

§

impl<F> Forget for OnceWith<F>

§

impl<F> Forget for PollFn<F>

§

impl<F> Forget for RepeatWith<F>

§

impl<G> Forget for FromCoroutine<G>

§

impl<H> Forget for BuildHasherDefault<H>

§

impl<I, F, const N: usize> Forget for MapWindows<I, F, N>

§

impl<I, F> Forget for FilterMap<I, F>

§

impl<I, F> Forget for Inspect<I, F>

§

impl<I, F> Forget for Map<I, F>

§

impl<I, G> Forget for IntersperseWith<I, G>

§

impl<I, P> Forget for Filter<I, P>

§

impl<I, P> Forget for MapWhile<I, P>

§

impl<I, P> Forget for SkipWhile<I, P>

§

impl<I, P> Forget for TakeWhile<I, P>

§

impl<I, St, F> Forget for Scan<I, St, F>

§

impl<I, U, F> Forget for FlatMap<I, U, F>

§

impl<I, const N: usize> Forget for ArrayChunks<I, N>

§

impl<I> Forget for Cloned<I>

§

impl<I> Forget for Copied<I>

§

impl<I> Forget for Cycle<I>

§

impl<I> Forget for DecodeUtf16<I>

§

impl<I> Forget for Enumerate<I>

§

impl<I> Forget for Flatten<I>

§

impl<I> Forget for FromIter<I>

§

impl<I> Forget for Fuse<I>

§

impl<I> Forget for Intersperse<I>
where <I as Iterator>::Item: Sized,

§

impl<I> Forget for Peekable<I>

§

impl<I> Forget for Skip<I>

§

impl<I> Forget for StepBy<I>

§

impl<I> Forget for maybe_std::iter::Take<I>

§

impl<Idx> Forget for Clamp<Idx>

§

impl<Idx> Forget for maybe_std::ops::Range<Idx>

§

impl<Idx> Forget for maybe_std::range::Range<Idx>

§

impl<Idx> Forget for maybe_std::ops::RangeFrom<Idx>

§

impl<Idx> Forget for maybe_std::range::RangeFrom<Idx>

§

impl<Idx> Forget for maybe_std::ops::RangeInclusive<Idx>

§

impl<Idx> Forget for maybe_std::range::RangeInclusive<Idx>

§

impl<Idx> Forget for RangeTo<Idx>

§

impl<Idx> Forget for maybe_std::ops::RangeToInclusive<Idx>

§

impl<Idx> Forget for maybe_std::range::RangeToInclusive<Idx>

§

impl<P> Forget for MaybeDangling<P>
where P: ?Sized,

§

impl<Ptr> Forget for Pin<Ptr>

§

impl<T, E> Forget for Result<T, E>

§

impl<T, F> Forget for DropGuard<T, F>

§

impl<T, F> Forget for LazyCell<T, F>

§

impl<T, F> Forget for Successors<T, F>

§

impl<T, U> Forget for maybe_std::io::Chain<T, U>

§

impl<T, const N: usize> Forget for maybe_std::array::IntoIter<T, N>

§

impl<T, const N: usize> Forget for Mask<T, N>

§

impl<T, const N: usize> Forget for Simd<T, N>

§

impl<T, const VARIANT: u32, const FIELD: u32> Forget for FieldRepresentingType<T, VARIANT, FIELD>
where T: ?Sized,

§

impl<T> Forget for AssertUnwindSafe<T>

§

impl<T> Forget for Atomic<T>

§

impl<T> Forget for Bound<T>

§

impl<T> Forget for Cell<T>
where T: ?Sized,

§

impl<T> Forget for Complex<T>

§

impl<T> Forget for CovariantUnsafeCell<T>
where T: ?Sized,

§

impl<T> Forget for Cursor<T>

§

impl<T> Forget for Discriminant<T>

§

impl<T> Forget for DiscriminantOrd<T>

§

impl<T> Forget for maybe_std::iter::Empty<T>

§

impl<T> Forget for maybe_std::result::IntoIter<T>

§

impl<T> Forget for ManuallyDrop<T>
where T: ?Sized,

§

impl<T> Forget for MaybeUninit<T>

§

impl<T> Forget for NonNull<T>
where T: ?Sized,

§

impl<T> Forget for NonZero<T>

§

impl<T> Forget for NumBuffer<T>

§

impl<T> Forget for Once<T>

§

impl<T> Forget for OnceCell<T>

§

impl<T> Forget for Option<T>

§

impl<T> Forget for Pending<T>

§

impl<T> Forget for PhantomContravariant<T>
where T: ?Sized,

§

impl<T> Forget for PhantomCovariant<T>
where T: ?Sized,

§

impl<T> Forget for PhantomData<T>
where T: ?Sized,

§

impl<T> Forget for PhantomInvariant<T>
where T: ?Sized,

§

impl<T> Forget for Poll<T>

§

impl<T> Forget for Ready<T>

§

impl<T> Forget for RefCell<T>
where T: ?Sized,

§

impl<T> Forget for Rev<T>

§

impl<T> Forget for Reverse<T>

§

impl<T> Forget for Saturating<T>

§

impl<T> Forget for SyncUnsafeCell<T>
where T: ?Sized,

§

impl<T> Forget for SyncView<T>
where T: ?Sized,

§

impl<T> Forget for maybe_std::io::Take<T>

§

impl<T> Forget for TraitImpl<T>
where T: ?Sized,

§

impl<T> Forget for UnsafeCell<T>
where T: ?Sized,

§

impl<T> Forget for UnsafePinned<T>
where T: ?Sized,

§

impl<T> Forget for Wrapping<T>

§

impl<T> Forget for Yeet<T>

§

impl<Y, R> Forget for CoroutineState<Y, R>