Skip to content
Discussion options

You must be logged in to vote

This is blocked by specialization. Because rust does not yet support specialization of trait impls, we have to implement generically, which means the error type must be the same for all values of BITS and LIMBS. So even in the case where we can guarantee an Infallible conversion, the error unfortunately type cannot be Infallible

You can read about some related rough edges in the TryFrom impls here

It would be also great to do things like the following, but unfortunately also blocked by language features

impl<const BITS: usize, const LIMBS: usize> TryFrom<u128> for Uint<BITS, LIMBS> 
where 
    // blocked by const generics improvements
    BITS > 128
{
   ...
}

// blocked by specializatio…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jmg-duarte
Comment options

@prestwich
Comment options

Answer selected by jmg-duarte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants