Skip to content

Commit 63f60b0

Browse files
committed
Fix documentation of from_ne_bytes and from_le_bytes
1 parent 88f755f commit 63f60b0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/libcore/num/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1979,10 +1979,10 @@ When starting from a slice rather than an array, fallible conversion APIs can be
19791979
```
19801980
use std::convert::TryInto;
19811981
1982-
fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
1982+
fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
19831983
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
19841984
*input = rest;
1985-
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
1985+
", stringify!($SelfT), "::from_le_bytes(int_bytes.try_into().unwrap())
19861986
}
19871987
```"),
19881988
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
@@ -2020,10 +2020,10 @@ When starting from a slice rather than an array, fallible conversion APIs can be
20202020
```
20212021
use std::convert::TryInto;
20222022
2023-
fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
2023+
fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
20242024
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
20252025
*input = rest;
2026-
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
2026+
", stringify!($SelfT), "::from_ne_bytes(int_bytes.try_into().unwrap())
20272027
}
20282028
```"),
20292029
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
@@ -3695,10 +3695,10 @@ When starting from a slice rather than an array, fallible conversion APIs can be
36953695
```
36963696
use std::convert::TryInto;
36973697
3698-
fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
3698+
fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
36993699
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
37003700
*input = rest;
3701-
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
3701+
", stringify!($SelfT), "::from_le_bytes(int_bytes.try_into().unwrap())
37023702
}
37033703
```"),
37043704
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
@@ -3736,10 +3736,10 @@ When starting from a slice rather than an array, fallible conversion APIs can be
37363736
```
37373737
use std::convert::TryInto;
37383738
3739-
fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
3739+
fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
37403740
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
37413741
*input = rest;
3742-
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
3742+
", stringify!($SelfT), "::from_ne_bytes(int_bytes.try_into().unwrap())
37433743
}
37443744
```"),
37453745
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]

0 commit comments

Comments
 (0)