refactor: rename split_numbers to split

This commit is contained in:
Christoph J. Scherr 2024-05-12 17:58:31 +02:00
parent 33260726a1
commit 20b8f7a582
3 changed files with 5 additions and 4 deletions

View File

@ -25,4 +25,4 @@ pub const YOBI: u128 = 2u128.pow(80);
// use libpt_core; // use libpt_core;
pub mod datalayout; pub mod datalayout;
pub mod display; pub mod display;
pub mod split_numbers; pub mod split;

View File

@ -3,6 +3,7 @@
//! 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
@ -14,7 +15,7 @@
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// # use libpt_bintols::split_numbers::*; /// # use libpt_bintols::split::*;
/// ///
/// let x: u32 = 1717; /// let x: u32 = 1717;
/// ///
@ -22,7 +23,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 {

View File

@ -1,4 +1,4 @@
use libpt_bintols::split_numbers::*; use libpt_bintols::split::*;
#[test] #[test]
fn split_u128() { fn split_u128() {