You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.../// Create a native endian integer value from its representation/// as a byte array in big endian.///#[doc = $from_xe_bytes_doc]////// # Examples////// ```#[doc = concat!("let value = ", stringify!($SelfT),"::from_be_bytes(", $be_bytes,");")]#[doc = concat!("assert_eq!(value, ", $swap_op,");")]/// ```////// When starting from a slice rather than an array, fallible conversion APIs can be used:////// ```#[doc = concat!("fn read_be_", stringify!($SelfT),"(input: &mut &[u8]) -> ", stringify!($SelfT)," {")]#[doc = concat!(" let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT),">());")]/// *input = rest;#[doc = concat!(" ", stringify!($SelfT),"::from_be_bytes(int_bytes.try_into().unwrap())")]/// }/// ```#[stable(feature = "int_to_from_bytes", since = "1.32.0")]#[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")]#[must_use]#[inline]pubconstfnfrom_be_bytes(bytes:[u8; mem::size_of::<Self>()]) -> Self{Self::from_be(Self::from_ne_bytes(bytes))}
...
all parts that are not rendered by rust-analyzer are the parts that are different per int type, and put in there with #[doc = ...] and concat!(), the constant that is not evaluated is in [u8; mem::size_of::<Self>()] ([u8; 8] on 64 bit platforms)
The text was updated successfully, but these errors were encountered:
rust-analyzer version: rust-analyzer version: 0.4.1830-standalone
rustc version: rustc 1.77.0 (aedd173a2 2024-03-17)
editor or extension: Code OSS (on arch linux, installed with pacman,
code 1.87.2-1
)relevant settings: None
code snippet to reproduce:
for me, this looks like this:
but the doc should look like this: https://doc.rust-lang.org/std/primitive.usize.html#method.from_be_bytes
the function is defined like this:
all parts that are not rendered by rust-analyzer are the parts that are different per int type, and put in there with
#[doc = ...]
andconcat!()
, the constant that is not evaluated is in[u8; mem::size_of::<Self>()]
([u8; 8]
on 64 bit platforms)The text was updated successfully, but these errors were encountered: