lib: Import base64 at the top-level, and not in a module.

This commit is contained in:
Emmanuel Gil Peyrot 2017-04-21 02:46:41 +01:00
parent 8fba5cf966
commit 6ba22a43e5
3 changed files with 11 additions and 2 deletions

View file

@ -1,7 +1,6 @@
extern crate sha2; extern crate sha2;
extern crate sha3; extern crate sha3;
extern crate blake2; extern crate blake2;
extern crate base64;
use disco::{Feature, Identity, Disco}; use disco::{Feature, Identity, Disco};
use data_forms::DataForm; use data_forms::DataForm;
@ -9,6 +8,7 @@ use data_forms::DataForm;
use self::sha2::{Sha256, Sha512, Digest}; use self::sha2::{Sha256, Sha512, Digest};
use self::sha3::{Sha3_256, Sha3_512}; use self::sha3::{Sha3_256, Sha3_512};
use self::blake2::Blake2b; use self::blake2::Blake2b;
use base64;
fn compute_item(field: &str) -> Vec<u8> { fn compute_item(field: &str) -> Vec<u8> {
let mut bytes = field.as_bytes().to_vec(); let mut bytes = field.as_bytes().to_vec();

View file

@ -1,13 +1,15 @@
use std::convert::From; use std::convert::From;
use std::io; use std::io;
use base64;
use minidom; use minidom;
#[derive(Debug)] #[derive(Debug)]
pub enum Error { pub enum Error {
ParseError(&'static str),
IoError(io::Error), IoError(io::Error),
XMLError(minidom::Error), XMLError(minidom::Error),
ParseError(&'static str), Base64Error(base64::Base64Error),
} }
impl From<io::Error> for Error { impl From<io::Error> for Error {
@ -21,3 +23,9 @@ impl From<minidom::Error> for Error {
Error::XMLError(err) Error::XMLError(err)
} }
} }
impl From<base64::Base64Error> for Error {
fn from(err: base64::Base64Error) -> Error {
Error::Base64Error(err)
}
}

View file

@ -8,6 +8,7 @@
//! before being sent over the wire. //! before being sent over the wire.
extern crate minidom; extern crate minidom;
extern crate base64;
use minidom::Element; use minidom::Element;
/// Error type returned by every parser on failure. /// Error type returned by every parser on failure.