Corelib
Drop
pub trait Drop
struct Point { x: u128, y: u128, } fn foo(p: Point) {} // Error: `p` cannot be dropped
#[derive(Drop)] struct Point { x: u128, y: u128, } fn foo(p: Point) {} // OK: `p` is dropped at the end of the function
Was this page helpful?