Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ license = "MIT"
edition = "2021"

[dependencies]
num = "0.4"
byteorder = "1"
libflate = "2"
num-bigint = "0.4"
num-traits = "0.2.19"
4 changes: 2 additions & 2 deletions src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use byteorder::BigEndian;
use byteorder::ReadBytesExt;
use byteorder::WriteBytesExt;
use libflate::zlib;
use num::bigint::BigInt;
use num_bigint::BigInt;
use std::convert::From;
use std::io;
use std::io::Write;
Expand Down Expand Up @@ -767,7 +767,7 @@ impl<W: io::Write> Encoder<W> {
}

mod aux {
use num::bigint::Sign;
use num_bigint::Sign;
use std::io;
use std::ops::Range;
use std::str;
Expand Down
32 changes: 16 additions & 16 deletions src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl AsOption for bool {
}
}

impl num::traits::ToPrimitive for FixInteger {
impl num_traits::ToPrimitive for FixInteger {
fn to_i64(&self) -> Option<i64> {
Some(i64::from(self.value))
}
Expand All @@ -115,7 +115,7 @@ impl num::traits::ToPrimitive for FixInteger {
Some(f64::from(self.value))
}
}
impl num::traits::ToPrimitive for BigInteger {
impl num_traits::ToPrimitive for BigInteger {
fn to_i64(&self) -> Option<i64> {
self.value.to_i64()
}
Expand All @@ -126,7 +126,7 @@ impl num::traits::ToPrimitive for BigInteger {
self.value.to_f64()
}
}
impl num::traits::ToPrimitive for Float {
impl num_traits::ToPrimitive for Float {
fn to_i64(&self) -> Option<i64> {
None
}
Expand All @@ -137,7 +137,7 @@ impl num::traits::ToPrimitive for Float {
Some(self.value)
}
}
impl num::traits::ToPrimitive for Term {
impl num_traits::ToPrimitive for Term {
fn to_i64(&self) -> Option<i64> {
match *self {
Term::FixInteger(ref x) => x.to_i64(),
Expand All @@ -162,18 +162,18 @@ impl num::traits::ToPrimitive for Term {
}
}

impl num::bigint::ToBigInt for FixInteger {
fn to_bigint(&self) -> Option<num::bigint::BigInt> {
impl num_bigint::ToBigInt for FixInteger {
fn to_bigint(&self) -> Option<num_bigint::BigInt> {
Some(BigInteger::from(self).value)
}
}
impl num::bigint::ToBigInt for BigInteger {
fn to_bigint(&self) -> Option<num::bigint::BigInt> {
impl num_bigint::ToBigInt for BigInteger {
fn to_bigint(&self) -> Option<num_bigint::BigInt> {
Some(self.value.clone())
}
}
impl num::bigint::ToBigInt for Term {
fn to_bigint(&self) -> Option<num::bigint::BigInt> {
impl num_bigint::ToBigInt for Term {
fn to_bigint(&self) -> Option<num_bigint::BigInt> {
match *self {
Term::FixInteger(ref x) => x.to_bigint(),
Term::BigInteger(ref x) => x.to_bigint(),
Expand All @@ -182,18 +182,18 @@ impl num::bigint::ToBigInt for Term {
}
}

impl num::bigint::ToBigUint for FixInteger {
fn to_biguint(&self) -> Option<num::bigint::BigUint> {
impl num_bigint::ToBigUint for FixInteger {
fn to_biguint(&self) -> Option<num_bigint::BigUint> {
BigInteger::from(self).value.to_biguint()
}
}
impl num::bigint::ToBigUint for BigInteger {
fn to_biguint(&self) -> Option<num::bigint::BigUint> {
impl num_bigint::ToBigUint for BigInteger {
fn to_biguint(&self) -> Option<num_bigint::BigUint> {
self.value.to_biguint()
}
}
impl num::bigint::ToBigUint for Term {
fn to_biguint(&self) -> Option<num::bigint::BigUint> {
impl num_bigint::ToBigUint for Term {
fn to_biguint(&self) -> Option<num_bigint::BigUint> {
match *self {
Term::FixInteger(ref x) => x.to_biguint(),
Term::BigInteger(ref x) => x.to_biguint(),
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
//!
//! - [Erlang External Term Format](http://erlang.org/doc/apps/erts/erl_ext_dist.html)
//!
use num::bigint::BigInt;
use num_bigint::BigInt;
use std::collections::HashMap;
use std::fmt;
use std::hash::Hash;
Expand Down Expand Up @@ -557,7 +557,7 @@ impl fmt::Display for InternalFun {
uniq,
..
} => {
use num::bigint::Sign;
use num_bigint::Sign;
let uniq = BigInt::from_bytes_be(Sign::Plus, &uniq);
write!(f, "#Fun<{}.{}.{}>", module, index, uniq)
}
Expand Down
10 changes: 5 additions & 5 deletions src/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
use super::*;
use crate::convert::AsOption;
use crate::convert::TryAsRef;
use num::bigint::ToBigInt;
use num::bigint::ToBigUint;
use num::traits::ToPrimitive;
use num_bigint::ToBigInt;
use num_bigint::ToBigUint;
use num_traits::ToPrimitive;
use std::fmt::Debug;

pub type Result<'a, T> = std::result::Result<T, Unmatch<'a>>;
Expand Down Expand Up @@ -838,7 +838,7 @@ impl<'a> Pattern<'a> for I64 {
#[derive(Debug, Clone)]
pub struct Int;
impl<'a> Pattern<'a> for Int {
type Output = num::BigInt;
type Output = num_bigint::BigInt;
fn try_match(&self, input: &'a Term) -> Result<'a, Self::Output> {
input.to_bigint().ok_or_else(|| self.unmatched(input))
}
Expand All @@ -847,7 +847,7 @@ impl<'a> Pattern<'a> for Int {
#[derive(Debug, Clone)]
pub struct Uint;
impl<'a> Pattern<'a> for Uint {
type Output = num::BigUint;
type Output = num_bigint::BigUint;
fn try_match(&self, input: &'a Term) -> Result<'a, Self::Output> {
input.to_biguint().ok_or_else(|| self.unmatched(input))
}
Expand Down
3 changes: 0 additions & 3 deletions tests/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
extern crate eetf;
extern crate num;

use eetf::*;
use std::io::Cursor;

Expand Down