on-internet
← Community

Permissions of a mutable parameter holding a mutable reference

Stack Overflow ·

I'd like to know what would be the permission of a mutable parameter of a function which holds a mutable reference, and how would the permissions change if the parameter is holding a non-mutable reference? fn mod_string(mut name: &mut String) { *name = "B".to_string(); } For this piece of code, what would be the permissions for name variable in terms of R, O, W, F, as mentioned in the Rust Book? I'm just playing around to get a better understanding of ownership, references and permissions. I'm learning Rust from the experimental Rust Book.

Comments

Sign in or sign up to comment and upvote.

No comments yet.