Trait Drop

1.6.0 (const: unstable) ยท Source
pub trait Drop {
    // Required method
    fn drop(&mut self);
}
Expand description

Custom code within the destructor.

When a value is no longer needed, Rust will run a โ€œdestructorโ€ on that value. The most common way that a value is no longer needed is when it goes out of scope. Destructors may still run in other circumstances, but weโ€™re going to focus on scope for the examples here. To learn about some of those other cases, please see the reference section on destructors.

This destructor consists of two components:

  • A call to Drop::drop for that value, if this special Drop trait is implemented for its type.
  • The automatically generated โ€œdrop glueโ€ which recursively calls the destructors of all the fields of this value.

As Rust automatically calls the destructors of all contained fields, you donโ€™t have to implement Drop in most cases. But there are some cases where it is useful, for example for types which directly manage a resource. That resource may be memory, it may be a file descriptor, it may be a network socket. Once a value of that type is no longer going to be used, it should โ€œclean upโ€ its resource by freeing the memory or closing the file or socket. This is the job of a destructor, and therefore the job of Drop::drop.

ยงExamples

To see destructors in action, letโ€™s take a look at the following program:

struct HasDrop;

impl Drop for HasDrop {
    fn drop(&mut self) {
        println!("Dropping HasDrop!");
    }
}

struct HasTwoDrops {
    one: HasDrop,
    two: HasDrop,
}

impl Drop for HasTwoDrops {
    fn drop(&mut self) {
        println!("Dropping HasTwoDrops!");
    }
}

fn main() {
    let _x = HasTwoDrops { one: HasDrop, two: HasDrop };
    println!("Running!");
}

Rust will first call Drop::drop for _x and then for both _x.one and _x.two, meaning that running this will print

Running!
Dropping HasTwoDrops!
Dropping HasDrop!
Dropping HasDrop!

Even if we remove the implementation of Drop for HasTwoDrop, the destructors of its fields are still called. This would result in

Running!
Dropping HasDrop!
Dropping HasDrop!

ยงYou cannot call Drop::drop yourself

Because Drop::drop is used to clean up a value, it may be dangerous to use this value after the method has been called. As Drop::drop does not take ownership of its input, Rust prevents misuse by not allowing you to call Drop::drop directly.

In other words, if you tried to explicitly call Drop::drop in the above example, youโ€™d get a compiler error.

If youโ€™d like to explicitly call the destructor of a value, mem::drop can be used instead.

ยงDrop order

Which of our two HasDrop drops first, though? For structs, itโ€™s the same order that theyโ€™re declared: first one, then two. If youโ€™d like to try this yourself, you can modify HasDrop above to contain some data, like an integer, and then use it in the println! inside of Drop. This behavior is guaranteed by the language.

Unlike for structs, local variables are dropped in reverse order:

struct Foo;

impl Drop for Foo {
    fn drop(&mut self) {
        println!("Dropping Foo!")
    }
}

struct Bar;

impl Drop for Bar {
    fn drop(&mut self) {
        println!("Dropping Bar!")
    }
}

fn main() {
    let _foo = Foo;
    let _bar = Bar;
}

This will print

Dropping Bar!
Dropping Foo!

Please see the reference for the full rules.

ยงCopy and Drop are exclusive

You cannot implement both Copy and Drop on the same type. Types that are Copy get implicitly duplicated by the compiler, making it very hard to predict when, and how often destructors will be executed. As such, these types cannot have destructors.

ยงDrop check

Dropping interacts with the borrow checker in subtle ways: when a type T is being implicitly dropped as some variable of this type goes out of scope, the borrow checker needs to ensure that calling Tโ€™s destructor at this moment is safe. In particular, it also needs to be safe to recursively drop all the fields of T. For example, it is crucial that code like the following is being rejected:

โ“˜
use std::cell::Cell;

struct S<'a>(Cell<Option<&'a S<'a>>>, Box<i32>);
impl Drop for S<'_> {
    fn drop(&mut self) {
        if let Some(r) = self.0.get() {
            // Print the contents of the `Box` in `r`.
            println!("{}", r.1);
        }
    }
}

fn main() {
    // Set up two `S` that point to each other.
    let s1 = S(Cell::new(None), Box::new(42));
    let s2 = S(Cell::new(Some(&s1)), Box::new(42));
    s1.0.set(Some(&s2));
    // Now they both get dropped. But whichever is the 2nd one
    // to be dropped will access the `Box` in the first one,
    // which is a use-after-free!
}

The Nomicon discusses the need for drop check in more detail.

To reject such code, the โ€œdrop checkโ€ analysis determines which types and lifetimes need to still be live when T gets dropped. The exact details of this analysis are not yet stably guaranteed and subject to change. Currently, the analysis works as follows:

  • If T has no drop glue, then trivially nothing is required to be live. This is the case if neither T nor any of its (recursive) fields have a destructor (impl Drop). PhantomData, arrays of length 0 and ManuallyDrop are considered to never have a destructor, no matter their field type.
  • If T has drop glue, then, for all types U that are owned by any field of T, recursively add the types and lifetimes that need to be live when U gets dropped. The set of owned types is determined by recursively traversing T:
    • Recursively descend through PhantomData, Box, tuples, and arrays (excluding arrays of length 0).
    • Stop at reference and raw pointer types as well as function pointers and function items; they do not own anything.
    • Stop at non-composite types (type parameters that remain generic in the current context and base types such as integers and bool); these types are owned.
    • When hitting an ADT with impl Drop, stop there; this type is owned.
    • When hitting an ADT without impl Drop, recursively descend to its fields. (For an enum, consider all fields of all variants.)
  • Furthermore, if T implements Drop, then all generic (lifetime and type) parameters of T must be live.

In the above example, the last clause implies that 'a must be live when S<'a> is dropped, and hence the example is rejected. If we remove the impl Drop, the liveness requirement disappears and the example is accepted.

There exists an unstable way for a type to opt-out of the last clause; this is called โ€œdrop check eyepatchโ€ or may_dangle. For more details on this nightly-only feature, see the discussion in the Nomicon.

Required Methodsยง

1.0.0 ยท Source

fn drop(&mut self)

Executes the destructor for this type.

This method is called implicitly when the value goes out of scope, and cannot be called explicitly (this is compiler error E0040). However, the mem::drop function in the prelude can be used to call the argumentโ€™s Drop implementation.

When this method has been called, self has not yet been deallocated. That only happens after the method is over. If this wasnโ€™t the case, self would be a dangling reference.

ยงPanics

Implementations should generally avoid panic!ing, because drop() may itself be called during unwinding due to a panic, and if the drop() panics in that situation (a โ€œdouble panicโ€), this will likely abort the program. It is possible to check panicking() first, which may be desirable for a Drop implementation that is reporting a bug of the kind โ€œyou didnโ€™t finish using this before it was droppedโ€; but most types should simply clean up their owned allocations or other resources and return normally from drop(), regardless of what state they are in.

Note that even if this panics, the value is considered to be dropped; you must not cause drop to be called again. This is normally automatically handled by the compiler, but when using unsafe code, can sometimes occur unintentionally, particularly when using ptr::drop_in_place.

Implementorsยง

ยง

impl Drop for ResetErrorHookOnDrop

ยง

impl Drop for SuppressResourceLoad

ยง

impl Drop for TaskHandle

ยง

impl Drop for BytesMut

ยง

impl Drop for Bytes

Sourceยง

impl Drop for LocalWaker

1.36.0 ยท Sourceยง

impl Drop for Waker

1.13.0 ยท Sourceยง

impl Drop for CString

1.6.0 ยท Sourceยง

impl Drop for alloc::string::Drain<'_>

1.63.0 ยท Sourceยง

impl Drop for OwnedFd

Sourceยง

impl Drop for Error

Sourceยง

impl Drop for Report

Sourceยง

impl Drop for Buf

Sourceยง

impl Drop for Config

Sourceยง

impl Drop for Cred

Sourceยง

impl Drop for DiffStats

Sourceยง

impl Drop for Index

Sourceยง

impl Drop for Indexer<'_>

Sourceยง

impl Drop for Mailmap

Sourceยง

impl Drop for MergeFileResult

Sourceยง

impl Drop for OidArray

Sourceยง

impl Drop for Pathspec

Sourceยง

impl Drop for Reflog

Sourceยง

impl Drop for Repository

Sourceยง

impl Drop for StringArray

Sourceยง

impl Drop for git2::transaction::Transaction<'_>

Sourceยง

impl Drop for Transport

Sourceยง

impl Drop for Worktree

Sourceยง

impl Drop for Asn1BitString

Sourceยง

impl Drop for Asn1Enumerated

Sourceยง

impl Drop for Asn1GeneralizedTime

Sourceยง

impl Drop for Asn1Integer

Sourceยง

impl Drop for Asn1Object

Sourceยง

impl Drop for Asn1OctetString

Sourceยง

impl Drop for Asn1String

Sourceยง

impl Drop for Asn1Time

Sourceยง

impl Drop for BigNum

Sourceยง

impl Drop for BigNumContext

Sourceยง

impl Drop for Cipher

Sourceยง

impl Drop for CipherCtx

Sourceยง

impl Drop for CmsContentInfo

Sourceยง

impl Drop for Conf

Sourceยง

impl Drop for Deriver<'_>

Sourceยง

impl Drop for DsaSig

Sourceยง

impl Drop for EcGroup

Sourceยง

impl Drop for EcPoint

Sourceยง

impl Drop for EcdsaSig

Sourceยง

impl Drop for Decrypter<'_>

Sourceยง

impl Drop for Encrypter<'_>

Sourceยง

impl Drop for Hasher

Sourceยง

impl Drop for LibCtx

Sourceยง

impl Drop for Md

Sourceยง

impl Drop for MdCtx

Sourceยง

impl Drop for OcspBasicResponse

Sourceยง

impl Drop for OcspCertId

Sourceยง

impl Drop for OcspOneReq

Sourceยง

impl Drop for OcspRequest

Sourceยง

impl Drop for OcspResponse

Sourceยง

impl Drop for Pkcs7

Sourceยง

impl Drop for Pkcs7Signed

Sourceยง

impl Drop for Pkcs7SignerInfo

Sourceยง

impl Drop for Pkcs12

Sourceยง

impl Drop for Provider

Sourceยง

impl Drop for Signer<'_>

Sourceยง

impl Drop for Verifier<'_>

Sourceยง

impl Drop for SrtpProtectionProfile

Sourceยง

impl Drop for Ssl

Sourceยง

impl Drop for SslContext

Sourceยง

impl Drop for SslSession

Sourceยง

impl Drop for OpensslString

Sourceยง

impl Drop for X509Store

Sourceยง

impl Drop for X509StoreBuilder

Sourceยง

impl Drop for AccessDescription

Sourceยง

impl Drop for DistPoint

Sourceยง

impl Drop for DistPointName

Sourceยง

impl Drop for GeneralName

Sourceยง

impl Drop for X509

Sourceยง

impl Drop for X509Algorithm

Sourceยง

impl Drop for X509Crl

Sourceยง

impl Drop for X509Extension

Sourceยง

impl Drop for X509Name

Sourceยง

impl Drop for X509NameEntry

Sourceยง

impl Drop for X509Object

Sourceยง

impl Drop for X509Req

Sourceยง

impl Drop for X509Revoked

Sourceยง

impl Drop for X509StoreContext

Sourceยง

impl Drop for X509VerifyParam

Sourceยง

impl Drop for TempDir

Sourceยง

impl Drop for TempPath

Sourceยง

impl Drop for Taker

Sourceยง

impl Drop for JsValue

ยง

impl Drop for AbortHandle

ยง

impl Drop for AeadKey

ยง

impl Drop for AggregationLimitsGuard

ยง

impl Drop for AlignedVec

ยง

impl Drop for AllocScratch

ยง

impl Drop for Ast

A custom Drop impl is used for Ast such that it uses constant stack space but heap space proportional to the depth of the Ast.

ยง

impl Drop for CancellationToken

ยง

impl Drop for ClassSet

A custom Drop impl is used for ClassSet such that it uses constant stack space but heap space proportional to the depth of the ClassSet.

ยง

impl Drop for DCtx<'_>

ยง

impl Drop for DefaultGuard

ยง

impl Drop for DropGuard

ยง

impl Drop for DropGuardRef<'_>

ยง

impl Drop for DuplexStream

ยง

impl Drop for Encoder<'_>

ยง

impl Drop for Enter

ยง

impl Drop for EnteredSpan

ยง

impl Drop for Erased

If into_inner() wasnโ€™t called, the value would leak and destructors wouldnโ€™t run, this prevents that from happening.

ยง

impl Drop for ErasedLocal

If into_inner() wasnโ€™t called, the value would leak and destructors wouldnโ€™t run, this prevents that from happening.

ยง

impl Drop for EventSource

ยง

impl Drop for EventSourceSubscription

ยง

impl Drop for FileProvider

ยง

impl Drop for GaiFuture

ยง

impl Drop for Guard

ยง

impl Drop for Hir

A custom Drop impl is used for HirKind such that it uses constant stack space but heap space proportional to the depth of the total Hir.

ยง

impl Drop for HpkePrivateKey

ยง

impl Drop for LocalEnterGuard

ยง

impl Drop for LocalHandle

ยง

impl Drop for LocalRuntime

ยง

impl Drop for LocalSet

ยง

impl Drop for MeasureTime

ยง

impl Drop for Notified<'_>

ยง

impl Drop for OkmBlock

ยง

impl Drop for OwnedNotified

ยง

impl Drop for OwnedSemaphorePermit

ยง

impl Drop for OwnedWriteHalf

ยง

impl Drop for OwnedWriteHalf

ยง

impl Drop for ReadableStreamBYOBReader<'_>

ยง

impl Drop for ReadableStreamDefaultReader<'_>

ยง

impl Drop for RecvAncillaryBuffer<'_>

ยง

impl Drop for RecvStream

ยง

impl Drop for RestoreOnPending

ยง

impl Drop for Runtime

ยง

impl Drop for SelectedOperation<'_>

ยง

impl Drop for SemaphoreGuard<'_>

ยง

impl Drop for SemaphoreGuardArc

ยง

impl Drop for SemaphorePermit<'_>

ยง

impl Drop for SharedSecret

ยง

impl Drop for Span

ยง

impl Drop for SpecialNonReactiveZoneGuard

ยง

impl Drop for SqliteOwnedBuf

ยง

impl Drop for Tag

ยง

impl Drop for ThreadPool

ยง

impl Drop for ThreadPool

ยง

impl Drop for WaitGroup

ยง

impl Drop for WebSocket

ยง

impl Drop for WritableStreamDefaultWriter<'_>

Sourceยง

impl<'a> Drop for OdbObject<'a>

Sourceยง

impl<'a> Drop for Signature<'a>

Sourceยง

impl<'a> Drop for TreeEntry<'a>

Sourceยง

impl<'a> Drop for ParseBuffer<'a>

Sourceยง

impl<'a> Drop for PathSegmentsMut<'a>

Sourceยง

impl<'a> Drop for UrlQuery<'a>

ยง

impl<'a> Drop for CCtx<'a>

ยง

impl<'a> Drop for CDict<'a>

ยง

impl<'a> Drop for CowArcStr<'a>

ยง

impl<'a> Drop for CowRcStr<'a>

ยง

impl<'a> Drop for DDict<'a>

ยง

impl<'a> Drop for Drain<'a>

ยง

impl<'a> Drop for Entered<'a>

ยง

impl<'a> Drop for LocalTimerFuture<'a>

Sourceยง

impl<'a, I> Drop for itertools::groupbylazy::Chunk<'a, I>
where I: Iterator, <I as Iterator>::Item: 'a,

ยง

impl<'a, I> Drop for Chunk<'a, I>
where I: Iterator, <I as Iterator>::Item: 'a,

ยง

impl<'a, K, F, A> Drop for DrainFilter<'a, K, F, A>
where A: Allocator + Clone, F: FnMut(&K) -> bool,

Sourceยง

impl<'a, K, I, F> Drop for itertools::groupbylazy::Group<'a, K, I, F>
where I: Iterator, <I as Iterator>::Item: 'a,

ยง

impl<'a, K, I, F> Drop for Group<'a, K, I, F>
where I: Iterator, <I as Iterator>::Item: 'a,

Sourceยง

impl<'a, K, V> Drop for slotmap::basic::Drain<'a, K, V>
where K: Key,

Sourceยง

impl<'a, K, V> Drop for slotmap::dense::Drain<'a, K, V>
where K: Key,

Sourceยง

impl<'a, K, V> Drop for slotmap::hop::Drain<'a, K, V>
where K: Key,

Sourceยง

impl<'a, K, V> Drop for slotmap::secondary::Drain<'a, K, V>
where K: Key,

Sourceยง

impl<'a, K, V> Drop for slotmap::sparse_secondary::Drain<'a, K, V>
where K: Key,

ยง

impl<'a, K, V, F, A> Drop for DrainFilter<'a, K, V, F, A>
where F: FnMut(&K, &mut V) -> bool, A: Allocator + Clone,

ยง

impl<'a, MutexType> Drop for GenericSemaphoreAcquireFuture<'a, MutexType>
where MutexType: RawMutex,

ยง

impl<'a, MutexType> Drop for GenericWaitForEventFuture<'a, MutexType>
where MutexType: RawMutex,

ยง

impl<'a, MutexType, T> Drop for ChannelReceiveFuture<'a, MutexType, T>

ยง

impl<'a, MutexType, T> Drop for ChannelSendFuture<'a, MutexType, T>

ยง

impl<'a, MutexType, T> Drop for GenericMutexLockFuture<'a, MutexType, T>
where MutexType: RawMutex,

ยง

impl<'a, MutexType, T> Drop for StateReceiveFuture<'a, MutexType, T>
where T: Clone,

ยง

impl<'a, R, G, T> Drop for MappedReentrantMutexGuard<'a, R, G, T>
where R: RawMutex + 'a, G: GetThreadId + 'a, T: 'a + ?Sized,

ยง

impl<'a, R, G, T> Drop for ReentrantMutexGuard<'a, R, G, T>
where R: RawMutex + 'a, G: GetThreadId + 'a, T: 'a + ?Sized,

ยง

impl<'a, R, T> Drop for MappedMutexGuard<'a, R, T>
where R: RawMutex + 'a, T: 'a + ?Sized,

ยง

impl<'a, R, T> Drop for MappedRwLockReadGuard<'a, R, T>
where R: RawRwLock + 'a, T: 'a + ?Sized,

ยง

impl<'a, R, T> Drop for MappedRwLockWriteGuard<'a, R, T>
where R: RawRwLock + 'a, T: 'a + ?Sized,

ยง

impl<'a, R, T> Drop for MutexGuard<'a, R, T>
where R: RawMutex + 'a, T: 'a + ?Sized,

ยง

impl<'a, R, T> Drop for RwLockReadGuard<'a, R, T>
where R: RawRwLock + 'a, T: 'a + ?Sized,

ยง

impl<'a, R, T> Drop for RwLockUpgradableReadGuard<'a, R, T>
where R: RawRwLockUpgrade + 'a, T: 'a + ?Sized,

ยง

impl<'a, R, T> Drop for RwLockWriteGuard<'a, R, T>
where R: RawRwLock + 'a, T: 'a + ?Sized,

ยง

impl<'a, T> Drop for flams_router_vscode::server_fn::axum_export::http::header::Drain<'a, T>

ยง

impl<'a, T> Drop for ValueDrain<'a, T>

ยง

impl<'a, T> Drop for Drain<'a, T>
where T: 'a + Array,

ยง

impl<'a, T> Drop for Drain<'a, T>
where T: Ord + Send,

ยง

impl<'a, T> Drop for Drain<'a, T>
where T: Send,

ยง

impl<'a, T> Drop for Locked<'a, T>

ยง

impl<'a, T> Drop for MappedMutexGuard<'a, T>
where T: ?Sized,

ยง

impl<'a, T> Drop for RecvFut<'a, T>

ยง

impl<'a, T> Drop for RwLockMappedWriteGuard<'a, T>
where T: ?Sized,

ยง

impl<'a, T> Drop for RwLockReadGuard<'a, T>
where T: ?Sized,

ยง

impl<'a, T> Drop for RwLockWriteGuard<'a, T>
where T: ?Sized,

ยง

impl<'a, T> Drop for SendFut<'a, T>

ยง

impl<'a, T> Drop for SpinMutexGuard<'a, T>
where T: ?Sized,

Sourceยง

impl<'a, T, A> Drop for DrainSorted<'a, T, A>
where T: Ord, A: Allocator,

Sourceยง

impl<'a, T, C> Drop for Ref<'a, T, C>
where T: Clear + Default, C: Config,

Sourceยง

impl<'a, T, C> Drop for RefMut<'a, T, C>
where T: Clear + Default, C: Config,

Sourceยง

impl<'a, T, C> Drop for Entry<'a, T, C>
where C: Config,

Sourceยง

impl<'a, T, U> Drop for FromColorMutGuard<'a, T, U>
where T: FromColorMut<U> + ?Sized, U: FromColorMut<T> + ?Sized,

Sourceยง

impl<'a, T, U> Drop for FromColorUnclampedMutGuard<'a, T, U>

ยง

impl<'a, T, const N: usize> Drop for Drain<'a, T, N>
where T: 'a,

Sourceยง

impl<'buffers> Drop for Patch<'buffers>

ยง

impl<'c, DB> Drop for Transaction<'c, DB>
where DB: Database,

Sourceยง

impl<'cfg> Drop for ConfigEntries<'cfg>

Sourceยง

impl<'cfg> Drop for ConfigEntry<'cfg>

ยง

impl<'data, T> Drop for AncillaryIter<'data, T>

ยง

impl<'data, T> Drop for Drain<'data, T>
where T: Send,

ยง

impl<'e, E, W> Drop for EncoderWriter<'e, E, W>
where E: Engine, W: Write,

Sourceยง

impl<'f> Drop for VaListImpl<'f>

Sourceยง

impl<'index> Drop for IndexConflicts<'index>

Sourceยง

impl<'ps> Drop for PathspecMatchList<'ps>

ยง

impl<'q> Drop for QueryLogger<'q>

ยง

impl<'reader> Drop for IntoAsyncRead<'reader>

ยง

impl<'reader> Drop for IntoStream<'reader>

Sourceยง

impl<'repo> Drop for Blame<'repo>

Sourceยง

impl<'repo> Drop for Blob<'repo>

Sourceยง

impl<'repo> Drop for BlobWriter<'repo>

Sourceยง

impl<'repo> Drop for Branches<'repo>

Sourceยง

impl<'repo> Drop for Commit<'repo>

Sourceยง

impl<'repo> Drop for Describe<'repo>

Sourceยง

impl<'repo> Drop for Diff<'repo>

Sourceยง

impl<'repo> Drop for AnnotatedCommit<'repo>

Sourceยง

impl<'repo> Drop for Note<'repo>

Sourceยง

impl<'repo> Drop for Notes<'repo>

Sourceยง

impl<'repo> Drop for Object<'repo>

Sourceยง

impl<'repo> Drop for Odb<'repo>

Sourceยง

impl<'repo> Drop for OdbPackwriter<'repo>

Sourceยง

impl<'repo> Drop for OdbReader<'repo>

Sourceยง

impl<'repo> Drop for OdbWriter<'repo>

Sourceยง

impl<'repo> Drop for PackBuilder<'repo>

Sourceยง

impl<'repo> Drop for Rebase<'repo>

Sourceยง

impl<'repo> Drop for Reference<'repo>

Sourceยง

impl<'repo> Drop for References<'repo>

Sourceยง

impl<'repo> Drop for Remote<'repo>

Sourceยง

impl<'repo> Drop for Revwalk<'repo>

Sourceยง

impl<'repo> Drop for Statuses<'repo>

Sourceยง

impl<'repo> Drop for Submodule<'repo>

Sourceยง

impl<'repo> Drop for git2::tag::Tag<'repo>

Sourceยง

impl<'repo> Drop for Tree<'repo>

Sourceยง

impl<'repo> Drop for TreeBuilder<'repo>

Sourceยง

impl<'repo, 'connection, 'cb> Drop for RemoteConnection<'repo, 'connection, 'cb>

ยง

impl<'rwlock, T> Drop for RwLockReadGuard<'rwlock, T>
where T: ?Sized,

ยง

impl<'rwlock, T, R> Drop for RwLockUpgradableGuard<'rwlock, T, R>
where T: ?Sized,

ยง

impl<'rwlock, T, R> Drop for RwLockWriteGuard<'rwlock, T, R>
where T: ?Sized,

ยง

impl<A> Drop for IntoIter<A>
where A: Array,

ยง

impl<A> Drop for SmallVec<A>
where A: Array,

ยง

impl<A, B> Drop for ArcUnion<A, B>

ยง

impl<C> Drop for CartableOptionPointer<C>
where C: CartablePointerLike,

ยง

impl<D> Drop for IndexWriter<D>
where D: Document,

ยง

impl<DB> Drop for PoolConnection<DB>
where DB: Database,

Returns the connection to the [Pool][crate::pool::Pool] it was checked-out from.

ยง

impl<F> Drop for LossyDecoder<F>
where F: FnMut(&str),

ยง

impl<F, A> Drop for Tendril<F, A>
where F: Format, A: Atomicity,

ยง

impl<Fut> Drop for FuturesUnordered<Fut>

ยง

impl<Fut> Drop for Shared<Fut>
where Fut: Future,

ยง

impl<H, T> Drop for ThinArc<H, T>

1.21.0 ยท Sourceยง

impl<I, A> Drop for alloc::vec::splice::Splice<'_, I, A>
where I: Iterator, A: Allocator,

ยง

impl<I, A> Drop for Splice<'_, I, A>
where I: Iterator, A: Allocator,

ยง

impl<I, K, V, S> Drop for Splice<'_, I, K, V, S>
where I: Iterator<Item = (K, V)>, K: Hash + Eq, S: BuildHasher,

ยง

impl<Inner, Prev, K, T, Guard> Drop for KeyedSubfieldWriteGuard<Inner, Prev, K, T, Guard>
where KeyedSubfield<Inner, Prev, K, T>: Clone, &'a T: for<'a> IntoIterator, Inner: StoreField<Value = Prev>, Prev: 'static, K: Debug + Send + Sync + PartialEq + Eq + Hash + 'static,

ยง

impl<K, V> Drop for Drain<'_, K, V>

ยง

impl<K, V> Drop for IntoIter<K, V>

1.7.0 ยท Sourceยง

impl<K, V, A> Drop for BTreeMap<K, V, A>
where A: Allocator + Clone,

1.7.0 ยท Sourceยง

impl<K, V, A> Drop for alloc::collections::btree::map::IntoIter<K, V, A>
where A: Allocator + Clone,

ยง

impl<K, V, S> Drop for LinkedHashMap<K, V, S>

ยง

impl<K, V, S> Drop for LruCache<K, V, S>

ยง

impl<M> Drop for UnmountHandle<M>
where M: Mountable,

ยง

impl<MutexType> Drop for GenericSemaphoreReleaser<'_, MutexType>
where MutexType: RawMutex,

ยง

impl<MutexType> Drop for GenericSharedSemaphoreAcquireFuture<MutexType>
where MutexType: RawMutex,

ยง

impl<MutexType> Drop for GenericSharedSemaphoreReleaser<MutexType>
where MutexType: RawMutex,

ยง

impl<MutexType, T> Drop for ChannelReceiveFuture<MutexType, T>

ยง

impl<MutexType, T> Drop for ChannelSendFuture<MutexType, T>

ยง

impl<MutexType, T> Drop for GenericMutexGuard<'_, MutexType, T>
where MutexType: RawMutex,

ยง

impl<MutexType, T> Drop for GenericOneshotBroadcastReceiver<MutexType, T>
where MutexType: RawMutex, T: Clone,

ยง

impl<MutexType, T> Drop for GenericOneshotBroadcastSender<MutexType, T>
where MutexType: RawMutex, T: Clone,

ยง

impl<MutexType, T> Drop for GenericOneshotReceiver<MutexType, T>
where MutexType: RawMutex,

ยง

impl<MutexType, T> Drop for GenericOneshotSender<MutexType, T>
where MutexType: RawMutex,

ยง

impl<MutexType, T> Drop for GenericStateReceiver<MutexType, T>
where MutexType: RawMutex, T: Clone,

ยง

impl<MutexType, T> Drop for GenericStateSender<MutexType, T>
where MutexType: RawMutex, T: Clone,

ยง

impl<MutexType, T> Drop for StateReceiveFuture<MutexType, T>

ยง

impl<MutexType, T, A> Drop for GenericReceiver<MutexType, T, A>
where MutexType: RawMutex, A: RingBuf<Item = T>,

ยง

impl<MutexType, T, A> Drop for GenericSender<MutexType, T, A>
where MutexType: RawMutex, A: RingBuf<Item = T>,

ยง

impl<R> Drop for ReadLine<'_, R>
where R: ?Sized,

Sourceยง

impl<S> Drop for SslStream<S>

ยง

impl<S, T> Drop for WriteGuard<S, T>
where S: Notify,

ยง

impl<Static> Drop for Atom<Static>

ยง

impl<T> Drop for flams_router_vscode::server_fn::axum_export::http::header::IntoIter<T>

Sourceยง

impl<T> Drop for ThinBox<T>
where T: ?Sized,

Sourceยง

impl<T> Drop for std::sync::mpmc::Receiver<T>

Sourceยง

impl<T> Drop for std::sync::mpmc::Sender<T>

Sourceยง

impl<T> Drop for std::sync::nonpoison::mutex::MappedMutexGuard<'_, T>
where T: ?Sized,

Sourceยง

impl<T> Drop for std::sync::nonpoison::mutex::MutexGuard<'_, T>
where T: ?Sized,

1.70.0 ยท Sourceยง

impl<T> Drop for OnceLock<T>

Sourceยง

impl<T> Drop for std::sync::poison::mutex::MappedMutexGuard<'_, T>
where T: ?Sized,

1.0.0 ยท Sourceยง

impl<T> Drop for std::sync::poison::mutex::MutexGuard<'_, T>
where T: ?Sized,

Sourceยง

impl<T> Drop for std::sync::poison::rwlock::MappedRwLockReadGuard<'_, T>
where T: ?Sized,

Sourceยง

impl<T> Drop for std::sync::poison::rwlock::MappedRwLockWriteGuard<'_, T>
where T: ?Sized,

1.0.0 ยท Sourceยง

impl<T> Drop for std::sync::poison::rwlock::RwLockReadGuard<'_, T>
where T: ?Sized,

1.0.0 ยท Sourceยง

impl<T> Drop for std::sync::poison::rwlock::RwLockWriteGuard<'_, T>
where T: ?Sized,

Sourceยง

impl<T> Drop for ReentrantLockGuard<'_, T>
where T: ?Sized,

Sourceยง

impl<T> Drop for Dh<T>

Sourceยง

impl<T> Drop for Dsa<T>

Sourceยง

impl<T> Drop for EcKey<T>

Sourceยง

impl<T> Drop for PKey<T>

Sourceยง

impl<T> Drop for PkeyCtx<T>

Sourceยง

impl<T> Drop for Rsa<T>

Sourceยง

impl<T> Drop for openssl::stack::IntoIter<T>
where T: Stackable,

Sourceยง

impl<T> Drop for Stack<T>
where T: Stackable,

Sourceยง

impl<T> Drop for X509Lookup<T>

Sourceยง

impl<T> Drop for X509LookupMethod<T>

Sourceยง

impl<T> Drop for Closure<T>
where T: ?Sized,

ยง

impl<T> Drop for Arc<T>
where T: ?Sized,

ยง

impl<T> Drop for ArcMutexGuardian<T>
where T: ?Sized,

ยง

impl<T> Drop for ArcRwLockReadGuardian<T>
where T: ?Sized,

ยง

impl<T> Drop for ArcRwLockWriteGuardian<T>
where T: ?Sized,

ยง

impl<T> Drop for ArrayQueue<T>

ยง

impl<T> Drop for AsyncFd<T>
where T: AsRawFd,

ยง

impl<T> Drop for AtomicCell<T>

ยง

impl<T> Drop for Drain<'_, T>

ยง

impl<T> Drop for Event<T>

ยง

impl<T> Drop for InactiveReceiver<T>

ยง

impl<T> Drop for Injector<T>

ยง

impl<T> Drop for Instrumented<T>

ยง

impl<T> Drop for JoinHandle<T>

ยง

impl<T> Drop for JoinSet<T>

ยง

impl<T> Drop for LocalFutureObj<'_, T>

ยง

impl<T> Drop for MutexGuard<'_, T>
where T: ?Sized,

ยง

impl<T> Drop for MutexGuard<'_, T>
where T: ?Sized,

ยง

impl<T> Drop for MutexGuard<'_, T>
where T: ?Sized,

ยง

impl<T> Drop for MutexGuardArc<T>
where T: ?Sized,

ยง

impl<T> Drop for MutexLockFuture<'_, T>
where T: ?Sized,

ยง

impl<T> Drop for OffsetArc<T>

ยง

impl<T> Drop for OnceBox<T>

ยง

impl<T> Drop for OnceCell<T>

ยง

impl<T> Drop for OnceCell<T>

ยง

impl<T> Drop for OnceCell<T>

ยง

impl<T> Drop for Owned<T>
where T: Pointable + ?Sized,

ยง

impl<T> Drop for OwnedMutexGuard<T>
where T: ?Sized,

ยง

impl<T> Drop for OwnedMutexGuard<T>
where T: ?Sized,

ยง

impl<T> Drop for OwnedMutexLockFuture<T>
where T: ?Sized,

ยง

impl<T> Drop for OwnedPermit<T>

ยง

impl<T> Drop for OwnedRwLockWriteGuard<T>
where T: ?Sized,

ยง

impl<T> Drop for Permit<'_, T>

ยง

impl<T> Drop for PermitIterator<'_, T>

ยง

impl<T> Drop for RcMutexGuardian<T>
where T: ?Sized,

ยง

impl<T> Drop for RcRwLockReadGuardian<T>
where T: ?Sized,

ยง

impl<T> Drop for RcRwLockWriteGuardian<T>
where T: ?Sized,

ยง

impl<T> Drop for Receiver<T>

ยง

impl<T> Drop for Receiver<T>

ยง

impl<T> Drop for Receiver<T>

ยง

impl<T> Drop for Receiver<T>

ยง

impl<T> Drop for Receiver<T>

ยง

impl<T> Drop for Receiver<T>

ยง

impl<T> Drop for Receiver<T>

ยง

impl<T> Drop for Receiver<T>

ยง

impl<T> Drop for Receiver<T>

ยง

impl<T> Drop for RenderEffectState<T>

ยง

impl<T> Drop for ResultState<T>
where T: Render,

ยง

impl<T> Drop for RwLockReadGuard<'_, T>
where T: ?Sized,

ยง

impl<T> Drop for RwLockReadGuardArc<T>

ยง

impl<T> Drop for RwLockUpgradableReadGuard<'_, T>
where T: ?Sized,

ยง

impl<T> Drop for RwLockUpgradableReadGuardArc<T>
where T: ?Sized,

ยง

impl<T> Drop for RwLockWriteGuard<'_, T>
where T: ?Sized,

ยง

impl<T> Drop for RwLockWriteGuardArc<T>
where T: ?Sized,

ยง

impl<T> Drop for ScratchVec<T>

ยง

impl<T> Drop for SegQueue<T>

ยง

impl<T> Drop for SendError<T>

ยง

impl<T> Drop for SendWrapper<T>

ยง

impl<T> Drop for Sender<T>

ยง

impl<T> Drop for Sender<T>

ยง

impl<T> Drop for Sender<T>

ยง

impl<T> Drop for Sender<T>

ยง

impl<T> Drop for Sender<T>

ยง

impl<T> Drop for Sender<T>

ยง

impl<T> Drop for Sender<T>

ยง

impl<T> Drop for Sender<T>

ยง

impl<T> Drop for SetOnce<T>

ยง

impl<T> Drop for ShardedLockWriteGuard<'_, T>
where T: ?Sized,

ยง

impl<T> Drop for ThreadLocal<T>
where T: Send,

ยง

impl<T> Drop for UnboundedReceiver<T>

ยง

impl<T> Drop for WeakSender<T>

ยง

impl<T> Drop for WeakSender<T>

ยง

impl<T> Drop for WeakUnboundedSender<T>

1.0.0 ยท Sourceยง

impl<T, A> Drop for alloc::boxed::Box<T, A>
where A: Allocator, T: ?Sized,

1.12.0 ยท Sourceยง

impl<T, A> Drop for PeekMut<'_, T, A>
where T: Ord, A: Allocator,

1.0.0 ยท Sourceยง

impl<T, A> Drop for LinkedList<T, A>
where A: Allocator,

1.6.0 ยท Sourceยง

impl<T, A> Drop for alloc::collections::vec_deque::drain::Drain<'_, T, A>
where A: Allocator,

1.0.0 ยท Sourceยง

impl<T, A> Drop for VecDeque<T, A>
where A: Allocator,

1.0.0 ยท Sourceยง

impl<T, A> Drop for Rc<T, A>
where A: Allocator, T: ?Sized,

Sourceยง

impl<T, A> Drop for UniqueRc<T, A>
where A: Allocator, T: ?Sized,

1.4.0 ยท Sourceยง

impl<T, A> Drop for alloc::rc::Weak<T, A>
where A: Allocator, T: ?Sized,

1.0.0 ยท Sourceยง

impl<T, A> Drop for alloc::sync::Arc<T, A>
where A: Allocator, T: ?Sized,

Sourceยง

impl<T, A> Drop for UniqueArc<T, A>
where A: Allocator, T: ?Sized,

1.4.0 ยท Sourceยง

impl<T, A> Drop for alloc::sync::Weak<T, A>
where A: Allocator, T: ?Sized,

1.6.0 ยท Sourceยง

impl<T, A> Drop for alloc::vec::drain::Drain<'_, T, A>
where A: Allocator,

1.0.0 ยท Sourceยง

impl<T, A> Drop for alloc::vec::into_iter::IntoIter<T, A>
where A: Allocator,

1.0.0 ยท Sourceยง

impl<T, A> Drop for alloc::vec::Vec<T, A>
where A: Allocator,

ยง

impl<T, A> Drop for ArrayBuf<T, A>
where A: AsMut<[T]> + AsRef<[T]> + RealArray<T>,

ยง

impl<T, A> Drop for Box<T, A>
where A: Allocator, T: ?Sized,

ยง

impl<T, A> Drop for Drain<'_, T, A>
where A: Allocator,

ยง

impl<T, A> Drop for IntoIter<T, A>
where A: Allocator,

ยง

impl<T, A> Drop for RawDrain<'_, T, A>
where A: Allocator,

ยง

impl<T, A> Drop for RawIntoIter<T, A>
where A: Allocator,

ยง

impl<T, A> Drop for RawTable<T, A>
where A: Allocator,

ยง

impl<T, A> Drop for Vec<T, A>
where A: Allocator,

Sourceยง

impl<T, C> Drop for OwnedRef<T, C>
where T: Clear + Default, C: Config,

Sourceยง

impl<T, C> Drop for OwnedRefMut<T, C>
where T: Clear + Default, C: Config,

Sourceยง

impl<T, C> Drop for OwnedEntry<T, C>
where C: Config,

Sourceยง

impl<T, F> Drop for flams_router_vscode::server_fn::inventory::core::mem::DropGuard<T, F>
where F: FnOnce(T),

1.80.0 ยท Sourceยง

impl<T, F> Drop for LazyLock<T, F>

ยง

impl<T, F> Drop for DrainFilter<'_, T, F>
where F: FnMut(&mut T) -> bool,

ยง

impl<T, F> Drop for Lazy<T, F>

ยง

impl<T, F> Drop for TaskLocalFuture<T, F>
where T: 'static,

1.87.0 ยท Sourceยง

impl<T, F, A> Drop for ExtractIf<'_, T, F, A>
where A: Allocator,

Sourceยง

impl<T, F, S> Drop for ScopeGuard<T, F, S>
where F: FnOnce(T), S: Strategy,

ยง

impl<T, N> Drop for GenericArrayIter<T, N>
where N: ArrayLength<T>,

ยง

impl<T, R> Drop for Once<T, R>

ยง

impl<T, S> Drop for ArcSwapAny<T, S>
where T: RefCnt, S: Strategy<T>,

ยง

impl<T, U> Drop for MappedMutexGuard<'_, T, U>
where T: ?Sized, U: ?Sized,

ยง

impl<T, U> Drop for OwnedMappedMutexGuard<T, U>
where T: ?Sized, U: ?Sized,

ยง

impl<T, U> Drop for OwnedRwLockMappedWriteGuard<T, U>
where T: ?Sized, U: ?Sized,

ยง

impl<T, U> Drop for OwnedRwLockReadGuard<T, U>
where T: ?Sized, U: ?Sized,

1.40.0 ยท Sourceยง

impl<T, const N: usize> Drop for flams_router_vscode::server_fn::inventory::core::array::IntoIter<T, N>

ยง

impl<T, const N: usize> Drop for IntoIter<T, N>

ยง

impl<T, const N: usize> Drop for SmallVec<T, N>

1.0.0 ยท Sourceยง

impl<W> Drop for BufWriter<W>
where W: Write + ?Sized,

Sourceยง

impl<W> Drop for GzEncoder<W>
where W: Write,

ยง

impl<W> Drop for Builder<W>
where W: AsyncWrite + Unpin + Send,

ยง

impl<W, F> Drop for AutoFinishEncoder<'_, W, F>
where W: Write, F: FnMut(Result<W, Error>),

ยง

impl<W, F> Drop for AutoFlushDecoder<'_, W, F>
where W: Write, F: FnMut(Result<(), Error>),

ยง

impl<Z> Drop for Zeroizing<Z>
where Z: Zeroize,