serde_mtproto 0.3.0

MTProto [de]serialization for Rust
Documentation
1
2
3
4
5
6
7
8
use num_traits::cast::{NumCast, cast};

use error::{self, ErrorKind};


pub fn safe_cast<T: NumCast, U: NumCast>(n: T) -> error::Result<U> {
    cast(n).ok_or(ErrorKind::IntegerCast.into())
}