Beginner Rust
Q33 / 100

What is the Drop trait?

Correct! Well done.

Incorrect.

The correct answer is B) A trait with fn drop(&mut self) called automatically when a value goes out of scope, for custom cleanup

B

Correct Answer

A trait with fn drop(&mut self) called automatically when a value goes out of scope, for custom cleanup

Explanation

impl Drop for MyResource { fn drop(&mut self) { /* cleanup */ } } runs when the value goes out of scope, implementing RAII.

Progress
33/100