learn_rust_bugs 0.1.0

Self-learning Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use log::info;

struct CustomSmartPointer {
    data: String,
}

impl Drop for CustomSmartPointer {
    fn drop(&mut self) {
        info!("drop CustomSmartPointer: {}", self.data);
    }
}

pub fn drop_test() {
    let a = CustomSmartPointer {
        data: "hello".to_string(),
    };
    drop(a);
}