Fix uuid and eui48

This commit is contained in:
Steven Fackler 2016-03-03 21:29:04 -08:00
parent e40b71ab97
commit dc52f84bcf
2 changed files with 2 additions and 4 deletions

View File

@ -6,12 +6,11 @@ use self::eui48::MacAddress;
use types::{FromSql, ToSql, Type, IsNull, SessionInfo};
use Result;
use util;
impl FromSql for MacAddress {
fn from_sql<R: Read>(_: &Type, raw: &mut R, _: &SessionInfo) -> Result<MacAddress> {
let mut bytes = [0; 6];
try!(util::read_all(raw, &mut bytes));
try!(raw.read_exact(&mut bytes));
Ok(MacAddress::new(bytes))
}

View File

@ -5,12 +5,11 @@ use std::io::prelude::*;
use self::uuid::Uuid;
use types::{FromSql, ToSql, Type, IsNull, SessionInfo};
use Result;
use util;
impl FromSql for Uuid {
fn from_sql<R: Read>(_: &Type, raw: &mut R, _: &SessionInfo) -> Result<Uuid> {
let mut bytes = [0; 16];
try!(util::read_all(raw, &mut bytes));
try!(raw.read_exact(&mut bytes));
Ok(Uuid::from_bytes(&bytes).unwrap())
}