Skip to content

Commit bff9148

Browse files
committed
Rename as_bytes_mut to as_mut_bytes Fixes #253
1 parent 4293509 commit bff9148

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/byteorder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ mod tests {
11701170
for _ in 0..RAND_ITERS {
11711171
let native = T::Native::rand(&mut r);
11721172
let mut bytes = T::ByteArray::default();
1173-
bytes.as_bytes_mut().copy_from_slice(native.as_bytes());
1173+
bytes.as_mut_bytes().copy_from_slice(native.as_bytes());
11741174
if invert {
11751175
bytes = bytes.invert();
11761176
}

src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,7 +2734,7 @@ pub unsafe trait IntoBytes {
27342734

27352735
/// Gets the bytes of this value mutably.
27362736
///
2737-
/// `as_bytes_mut` provides access to the bytes of this value as a mutable
2737+
/// `as_mut_bytes` provides access to the bytes of this value as a mutable
27382738
/// byte slice.
27392739
///
27402740
/// # Examples
@@ -2760,7 +2760,7 @@ pub unsafe trait IntoBytes {
27602760
/// checksum: [6, 7],
27612761
/// };
27622762
///
2763-
/// let bytes = header.as_bytes_mut();
2763+
/// let bytes = header.as_mut_bytes();
27642764
///
27652765
/// assert_eq!(bytes, [0, 1, 2, 3, 4, 5, 6, 7]);
27662766
///
@@ -2774,7 +2774,7 @@ pub unsafe trait IntoBytes {
27742774
/// });
27752775
/// ```
27762776
#[inline(always)]
2777-
fn as_bytes_mut(&mut self) -> &mut [u8]
2777+
fn as_mut_bytes(&mut self) -> &mut [u8]
27782778
where
27792779
Self: FromBytes + NoCell,
27802780
{
@@ -7749,7 +7749,7 @@ mod tests {
77497749
///
77507750
/// `bytes` is the expected byte sequence returned from `t.as_bytes()`
77517751
/// before `t` has been modified. `post_mutation` is the expected
7752-
/// sequence returned from `t.as_bytes()` after `t.as_bytes_mut()[0]`
7752+
/// sequence returned from `t.as_bytes()` after `t.as_mut_bytes()[0]`
77537753
/// has had its bits flipped (by applying `^= 0xFF`).
77547754
///
77557755
/// `N` is the size of `t` in bytes.
@@ -7764,9 +7764,9 @@ mod tests {
77647764

77657765
// Test that changes to the underlying byte slices are reflected in
77667766
// the original object.
7767-
t.as_bytes_mut()[0] ^= 0xFF;
7767+
t.as_mut_bytes()[0] ^= 0xFF;
77687768
assert_eq!(t, post_mutation);
7769-
t.as_bytes_mut()[0] ^= 0xFF;
7769+
t.as_mut_bytes()[0] ^= 0xFF;
77707770

77717771
// `write_to` rejects slices that are too small or too large.
77727772
assert_eq!(t.write_to(&mut vec![0; N - 1][..]), None);
@@ -8073,7 +8073,7 @@ mod tests {
80738073
//
80748074
// let r = <$ty as TryFromBytes>::try_from_ref(val.as_bytes()).unwrap();
80758075
// assert_eq!(r, &val);
8076-
// let r = <$ty as TryFromBytes>::try_from_mut(val.as_bytes_mut()).unwrap();
8076+
// let r = <$ty as TryFromBytes>::try_from_mut(val.as_mut_bytes()).unwrap();
80778077
// assert_eq!(r, &mut val);
80788078
// let v = <$ty as TryFromBytes>::try_read_from(val.as_bytes()).unwrap();
80798079
// assert_eq!(v, val);

0 commit comments

Comments
 (0)