Add ExpectInto numerological conversion trait. (#357)
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
12
src/core/utils/math/expect_into.rs
Normal file
12
src/core/utils/math/expect_into.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
pub trait ExpectInto {
|
||||
#[inline]
|
||||
#[must_use]
|
||||
fn expect_into<Dst: TryFrom<Self>>(self) -> Dst
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
super::expect_into::<Dst, Self>(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> ExpectInto for T {}
|
||||
Reference in New Issue
Block a user