Skip to content

How to cleanup object after being borrow_mut ?? #431

Discussion options

You must be logged in to vote

you should be able to borrow within a local scope:

ie:

let isFive = false;
{
    / / borrowed within bracket's local scope
    let some_struct = borrow_global_mut(obj_addr);
    some_struct.counter = some_struct.counter + 1;
    isFive = some_struct.counter == 5;
}
if(isFive){
delete object here (previous borrow is out-of-scope)

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@magnum6actual
Comment options

@kshitjee
Comment options

@ajaythxkur
Comment options

@MoonShiesty
Comment options

Answer selected by ajaythxkur
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants