Impl Serialize for Bound<T>

This commit is contained in:
Dmitry Shlagoff
2019-01-29 15:20:27 +07:00
parent bb99b31eb0
commit 4bb45c8252
5 changed files with 148 additions and 1 deletions
+18
View File
@@ -10,6 +10,7 @@ use std::path::{Path, PathBuf};
use std::rc::{Rc, Weak as RcWeak};
use std::sync::{Arc, Weak as ArcWeak};
use std::time::{Duration, UNIX_EPOCH};
use std::ops::Bound;
use fnv::FnvHasher;
use serde::{Deserialize, Deserializer};
@@ -836,6 +837,23 @@ declare_tests! {
Token::SeqEnd,
],
}
test_bound {
Bound::Unbounded::<()> => &[
Token::Enum { name: "Bound" },
Token::Str("Unbounded"),
Token::Unit,
],
Bound::Included(0) => &[
Token::Enum { name: "Bound" },
Token::Str("Included"),
Token::U8(0),
],
Bound::Excluded(0) => &[
Token::Enum { name: "Bound" },
Token::Str("Excluded"),
Token::U8(0),
],
}
test_path {
Path::new("/usr/local/lib") => &[
Token::BorrowedStr("/usr/local/lib"),
+1
View File
@@ -10,6 +10,7 @@ use std::path::{Path, PathBuf};
use std::rc::{Rc, Weak as RcWeak};
use std::sync::{Arc, Weak as ArcWeak};
use std::time::{Duration, UNIX_EPOCH};
use std::ops::Bound;
#[cfg(unix)]
use std::str;