Skip to content

Bikeshedding calling *u8 "buf" and [u8] "bytes" #3444

Closed
@erickt

Description

@erickt

We are a little inconsistent with how we name *u8 and [u8]. Sometimes we use the term buf to mean a *u8:

str::as_buf
str::unsafe::from_buf
str::unsafe::from_buf_len
str::unsafe::from_buf_len_nocopy
vec::as_buf
vec::as_const_buf
vec::as_mut_buf

Or it could mean [u8]:

flate::deflate_buf
flate::inflate_buf
int::parse_buf
io::mem_buffer_buf
io::with_buf_writer
uint::parse_buf

In other cases, we use bytes to mean [u8]:

hash::Streaming::result_bytes
hash::hash_bytes_keyed
hash::hash_bytes
io::ReaderUtil::read_bytes
io::with_bytes_reader
rand::Rng::gen_bytes
str::from_bytes
str::to_bytes
str::as_bytes
str::as_bytes_slice
str::from_bytes
str::push_bytes
str::unsafe::from_bytes
str::unsafe::push_bytes
ToBytes::to_bytes

I think we should fix this. What would you all think about standardizing on buf being used to represent *u8, and bytes being [u8]?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions