feat/bintols/split-numbers-to-bytes #77

Merged
PlexSheep merged 10 commits from feat/bintols/split-numbers-to-bytes into devel 2024-05-12 17:41:12 +02:00
1 changed files with 1 additions and 2 deletions
Showing only changes of commit 75feb7b2b0 - Show all commits

View File

@ -3,7 +3,6 @@
//! Sometimes, you need a large integer in the form of many bytes, so split into [u8]. //! Sometimes, you need a large integer in the form of many bytes, so split into [u8].
//! Rust provides //! Rust provides
/// Split unsigned integers into a [Vec] of [u8]s /// Split unsigned integers into a [Vec] of [u8]s
/// ///
/// Say you have the [u32] 1717 (binary: `00000000 00000000 00000110 10110101 `). This number would /// Say you have the [u32] 1717 (binary: `00000000 00000000 00000110 10110101 `). This number would
@ -23,7 +22,7 @@
/// ``` /// ```
pub fn unsigned_to_vec<T>(num: T) -> Vec<u8> pub fn unsigned_to_vec<T>(num: T) -> Vec<u8>
where where
u128: std::convert::From<T> u128: std::convert::From<T>,
{ {
let mut num: u128 = num.into(); let mut num: u128 = num.into();
if num == 0 { if num == 0 {