From 6ba22a43e5e11f4372569a4456c1f17bd418ebac Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 21 Apr 2017 02:46:41 +0100 Subject: [PATCH] lib: Import base64 at the top-level, and not in a module. --- src/ecaps2.rs | 2 +- src/error.rs | 10 +++++++++- src/lib.rs | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ecaps2.rs b/src/ecaps2.rs index 68012d96..fce5e6ea 100644 --- a/src/ecaps2.rs +++ b/src/ecaps2.rs @@ -1,7 +1,6 @@ extern crate sha2; extern crate sha3; extern crate blake2; -extern crate base64; use disco::{Feature, Identity, Disco}; use data_forms::DataForm; @@ -9,6 +8,7 @@ use data_forms::DataForm; use self::sha2::{Sha256, Sha512, Digest}; use self::sha3::{Sha3_256, Sha3_512}; use self::blake2::Blake2b; +use base64; fn compute_item(field: &str) -> Vec { let mut bytes = field.as_bytes().to_vec(); diff --git a/src/error.rs b/src/error.rs index bd7d2d9c..c55a52a1 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,13 +1,15 @@ use std::convert::From; use std::io; +use base64; use minidom; #[derive(Debug)] pub enum Error { + ParseError(&'static str), IoError(io::Error), XMLError(minidom::Error), - ParseError(&'static str), + Base64Error(base64::Base64Error), } impl From for Error { @@ -21,3 +23,9 @@ impl From for Error { Error::XMLError(err) } } + +impl From for Error { + fn from(err: base64::Base64Error) -> Error { + Error::Base64Error(err) + } +} diff --git a/src/lib.rs b/src/lib.rs index c9315f6e..50679604 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,6 +8,7 @@ //! before being sent over the wire. extern crate minidom; +extern crate base64; use minidom::Element; /// Error type returned by every parser on failure.