unicode-org / icu4x

Solving i18n for client-side and resource-constrained environments.
https://icu4x.unicode.org
Other
1.38k stars 178 forks source link

Clean up as_byte_slice vs as_bytes (etc) #5815

Closed Manishearth closed 1 week ago

Manishearth commented 1 week ago

The zerovec crate uses byte_slice and bytes to talk about methods working with &[u8]. We should pick one (I suggest as_bytes() etc since that's what the stdlib does)

$ rg "\b[a-zA-Z_]*_byte_slice[a-zA-Z_]*\b" --no-filename --only-matching -N | sort -u
as_byte_slice
from_byte_slice_unchecked
from_byte_slice_unchecked_mut
impl_byte_slice_signed_type
impl_byte_slice_size
impl_byte_slice_type
impl_byte_slice_unsigned_type
iule_from_byte_slice_unchecked_mut
parse_byte_slice
parse_byte_slice_with_length
parse_owned_byte_slice
validate_byte_slice
*_bytes* usage ``` $ rg "\b[a-zA-Z_]*_bytes[a-zA-Z_]*\b" --no-filename --only-matching -N | sort -u as_bytes as_encoded_bytes bincode_bytes _bytes char_bytes deserialize_bytes from_bytes from_bytes_unchecked from_bytes_unchecked_mut from_bytes_unchecked_with_length from_le_bytes get_bytes_at_mut get_serializable_bytes_non_empty indices_bytes into_bytes large_hashmap_postcard_bytes large_zerohashmap_postcard_bytes large_zeromap_postcard_bytes last_field_bytes le_bytes len_bytes postcard_bytes serialize_bytes shift_bytes to_be_bytes to_le_bytes try_from_bytes ule_bytes unsized_bytes visit_borrowed_bytes vzv_from_bytes write_serializable_bytes write_serializable_bytes_without_length zv_bytes ```

Everything but the impl ones should probably be changed,