Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1979,10 +1979,10 @@ When starting from a slice rather than an array, fallible conversion APIs can be
```
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
", stringify!($SelfT), "::from_le_bytes(int_bytes.try_into().unwrap())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the PR.

}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
Expand Down Expand Up @@ -2020,10 +2020,10 @@ When starting from a slice rather than an array, fallible conversion APIs can be
```
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
", stringify!($SelfT), "::from_ne_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
Expand Down Expand Up @@ -3695,10 +3695,10 @@ When starting from a slice rather than an array, fallible conversion APIs can be
```
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
", stringify!($SelfT), "::from_le_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
Expand Down Expand Up @@ -3736,10 +3736,10 @@ When starting from a slice rather than an array, fallible conversion APIs can be
```
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
", stringify!($SelfT), "::from_ne_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
Expand Down