Fix uuid and eui48
This commit is contained in:
parent
e40b71ab97
commit
dc52f84bcf
@ -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))
|
||||
}
|
||||
|
||||
|
@ -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())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user