Suggest _bytes versions of endian-converting methods

This commit is contained in:
Kornel 2025-11-25 00:55:38 +00:00
parent c871d09d1c
commit 3faad7cc41
No known key found for this signature in database

View file

@ -372,6 +372,8 @@ macro_rules! int_impl {
///
/// On big endian this is a no-op. On little endian the bytes are swapped.
///
/// See also [from_be_bytes()](Self::from_be_bytes).
///
/// # Examples
///
/// ```
@ -402,6 +404,8 @@ macro_rules! int_impl {
///
/// On little endian this is a no-op. On big endian the bytes are swapped.
///
/// See also [from_le_bytes()](Self::from_le_bytes).
///
/// # Examples
///
/// ```
@ -428,9 +432,15 @@ macro_rules! int_impl {
}
}
/// Converts `self` to big endian from the target's endianness.
/// Swaps bytes of `self` on little endian targets.
///
/// On big endian this is a no-op. On little endian the bytes are swapped.
/// On big endian this is a no-op.
///
/// The returned value has the same type as `self`, and will be interpreted
/// as (a potentially different) value of a native-endian
#[doc = concat!("`", stringify!($SelfT), "`.")]
///
/// See [`to_be_bytes()`](Self::to_be_bytes) for a type-safe alternative.
///
/// # Examples
///
@ -459,9 +469,15 @@ macro_rules! int_impl {
}
}
/// Converts `self` to little endian from the target's endianness.
/// Swaps bytes of `self` on big endian targets.
///
/// On little endian this is a no-op. On big endian the bytes are swapped.
/// On little endian this is a no-op.
///
/// The returned value has the same type as `self`, and will be interpreted
/// as (a potentially different) value of a native-endian
#[doc = concat!("`", stringify!($SelfT), "`.")]
///
/// See [`to_le_bytes()`](Self::to_le_bytes) for a type-safe alternative.
///
/// # Examples
///