Closed musjj closed 1 year ago
The simplest test of whether you have read permissions on a path p
is that you can construct an immutable reference &p
. For example, if you have a string s
, then you have read permissions if you can call s.len()
which desugars to str::len(&s)
.
This is a good question though-- I'll think about how we can make this clearer in the book
Thanks, that clarifies my doubt!
I was reading your version of The Rust Book, and I find the read/write/own permission concept pretty interesting. But I have a question, and since I don't know where else to ask about this, I'm posting this here. How do you test if a path is readable?
For example, you can test if a path has own and write permissions like this:
But how do you test if a path has read permission?