Skip to content
Discussion options

You must be logged in to vote

tl;dr you won't have to destroy the vector manually, unless the compiler tells you that that the vector was not droppable.

Situations you would need to use destroy

Destroy is only used if the struct does not have drop. The purpose here is to prevent losing data without specifically destroying the item.

If the item that you're storing is not drop then you'll have to use destroy. If it's drop it'll get destroyed automatically when you remove it from a resource on chain.

If the resource is not drop, and you don't destroy it, compilation will fail.

Example

module deployer::destroy_example {

    use std::signer;
    use std::vector;

    /// Resource to hold the item for this example
    stru…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gregnazario
Comment options

Answer selected by huisq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
move Questions related to the Move Language
3 participants