当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Rust i128.to_be_bytes用法及代码示例


本文简要介绍rust语言中 i128.to_be_bytes 的用法。

用法

pub const fn to_be_bytes(self) -> [u8; 16]

以大端(网络)字节顺序将此整数的内存表示形式返回为字节数组。

例子

let bytes = 0x12345678901234567890123456789012i128.to_be_bytes();
assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]);

相关用法


注:本文由纯净天空筛选整理自rust-lang.org大神的英文原创作品 i128.to_be_bytes。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。