Skip to content
masterclass Buddy

Rust · Trait

Drop

Drop lets a type run custom cleanup when its value is no longer needed. Rust calls drop automatically, and std::mem::drop can trigger cleanup early.

Last updated

Since
1.0.0

Syntax

pub trait Drop { fn drop(&mut self); }

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • std::mem::drop
  • Copy
  • std::ops::Drop
  • drop glue

Source: Drop in std::ops - Rust. Checked 2026-11-03.