Naming convention question

In std, we have as_bytes / as_bytes_mut and as_ptr / as _mut_ptr. Why mut's position changes between the two?

I read it as clumping "(as bytes) mut" versus "as (mut ptr)".

The difference is that "mut ptr" is a thing in the language (*mut _) whereas as_bytes_mut returns a mutable handle to the "same thing" that as_bytes returns.

I'm not sure if that's a good reason, but that's how I read the difference.

5 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.