aboutsummaryrefslogtreecommitdiff
path: root/src/model.rs
diff options
context:
space:
mode:
authorHristo Venev <hristo@venev.name>2019-03-19 17:46:48 +0200
committerHristo Venev <hristo@venev.name>2019-03-19 17:47:02 +0200
commit51c9e1433bf139759a41173aa63fa40855a10fac (patch)
tree5e7094a6eeaa5853717f6dbd3b57880aa28574c9 /src/model.rs
parentb7632fb35571f63fe28368c6508aa67fe8d775c8 (diff)
lintv0.1.0
Diffstat (limited to 'src/model.rs')
-rw-r--r--src/model.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/model.rs b/src/model.rs
index a7675f2..f8b76b5 100644
--- a/src/model.rs
+++ b/src/model.rs
@@ -2,11 +2,11 @@
//
// See COPYING.
-use base64;
use crate::bin;
-use crate::ip::{Ipv4Addr, Ipv6Addr, Ipv4Net, Ipv6Net, NetParseError};
-use std::{fmt};
-use std::collections::{HashMap};
+use crate::ip::{Ipv4Addr, Ipv4Net, Ipv6Addr, Ipv6Net, NetParseError};
+use base64;
+use std::collections::HashMap;
+use std::fmt;
use std::str::FromStr;
pub type KeyParseError = base64::DecodeError;
@@ -28,7 +28,11 @@ impl Key {
impl fmt::Display for Key {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{}", base64::display::Base64Display::with_config(&self.0, base64::STANDARD))
+ write!(
+ f,
+ "{}",
+ base64::display::Base64Display::with_config(&self.0, base64::STANDARD)
+ )
}
}
@@ -90,7 +94,7 @@ impl Endpoint {
pub fn ipv4_address(&self) -> Option<Ipv4Addr> {
let seg = self.address.octets();
let (first, second) = array_refs![&seg, 12, 4];
- if *first == [0,0,0,0,0,0,0,0,0,0,0xff,0xff] {
+ if *first == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff] {
Some(Ipv4Addr::from(*second))
} else {
None