Rust question

Правка en1, от yllo, 2023-06-30 20:11:30

Hi everyone!

I have a question about the language Rust.

Suppose, I've created some struct:

struct A {
  x: T,
  y: P,
  ....
}

When it goes out of the scope, Drop is called, memory is cleaned by recursive calls Drop? for all fields.

But what if I implement trait Drop for it:

impl Drop for A { fn drop(&mut self) -> () { // nothing } }

will the memory be also cleaned? Or i need to clean it in some other way?

Sorry for my pure English(.

Теги rust

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский yllo 2023-06-30 20:24:11 59
en4 Английский yllo 2023-06-30 20:14:36 0 (published)
en3 Английский yllo 2023-06-30 20:13:43 21
en2 Английский yllo 2023-06-30 20:11:58 12
en1 Английский yllo 2023-06-30 20:11:30 509 Initial revision (saved to drafts)