update to v0.5.1 #81

Merged
PlexSheep merged 7 commits from devel into master 2024-05-13 15:21:02 +02:00
1 changed files with 7 additions and 1 deletions
Showing only changes of commit 22d5b3ac07 - Show all commits

View File

@ -27,7 +27,13 @@ pub fn array_to_unsigned<T>(parts: &[u8]) -> anyhow::Result<T>
where
u128: std::convert::From<T>,
T: std::str::FromStr,
T: std::convert::TryFrom<u128>,
<T as std::str::FromStr>::Err: std::fmt::Debug,
<T as std::str::FromStr>::Err: std::error::Error,
<T as std::convert::TryFrom<u128>>::Error: std::error::Error,
<T as std::convert::TryFrom<u128>>::Error: std::marker::Send,
<T as std::convert::TryFrom<u128>>::Error: std::marker::Sync,
<T as std::convert::TryFrom<u128>>::Error: 'static,
{
trace!("amount of parts: {}", parts.len());
if parts.len() > (u128::BITS / 8) as usize {
@ -40,5 +46,5 @@ where
for (i, e) in parts.iter().rev().enumerate() {
ri += (*e as u128) * 256u128.pow(i as u32);
}
Ok(ri.to_string().parse().unwrap())
T::try_from(ri).map_err(anyhow::Error::from)
}