Open chanced opened 1 year ago
pub fn usize(&self) -> Result<usize, RandomError> { // future-proofing #[cfg(target_pointer_width = "128")] { let mut dst = [0; 16]; fill(&mut dst)?; Ok(usize::from_ne_bytes(dst)) } #[cfg(target_pointer_width = "64")] { let mut dst = [0; 8]; fill(&mut dst)?; Ok(usize::from_ne_bytes(dst)) } #[cfg(target_pointer_width = "32")] { let mut dst = [0; 4]; fill(&mut dst)?; Ok(usize::from_ne_bytes(dst)) } #[cfg(target_pointer_width = "16")] { let mut dst = [0; 2]; fill(&mut dst)?; Ok(usize::from_ne_bytes(dst)) } #[cfg(all( not(target_pointer_width = "128"), not(target_pointer_width = "64"), not(target_pointer_width = "32"), not(target_pointer_width = "16"), ))] { compile_error!("Unsupported target_pointer_width") } }