Rollup merge of #75211 - lzutao:native-endian-notes, r=lcnr

Note about endianness of returned value of {integer}::from_be_bytes and friends

[`u32::from_be`](https://doc.rust-lang.org/nightly/src/core/num/mod.rs.html#2883-2892) documents about endianness of returned value.

I was confused by endianness of `from_be_bytes` in #75086 .
This commit is contained in:
Yuki Okushi 2020-08-07 09:35:26 +09:00 committed by GitHub
commit 26705d5bcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4383,8 +4383,8 @@ assert_eq!(
}
doc_comment! {
concat!("Create an integer value from its representation as a byte array in
big endian.
concat!("Create a native endian integer value from its representation
as a byte array in big endian.
",
$from_xe_bytes_doc,
"
@ -4416,8 +4416,8 @@ fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
doc_comment! {
concat!("
Create an integer value from its representation as a byte array in
little endian.
Create a native endian integer value from its representation
as a byte array in little endian.
",
$from_xe_bytes_doc,
"
@ -4448,8 +4448,8 @@ fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
}
doc_comment! {
concat!("Create an integer value from its memory representation as a byte
array in native endianness.
concat!("Create a native endian integer value from its memory representation
as a byte array in native endianness.
As the target platform's native endianness is used, portable code
likely wants to use [`from_be_bytes`] or [`from_le_bytes`], as