diff options
author | Andrew Gallant <jamslam@gmail.com> | 2018-09-07 11:57:07 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2018-09-07 12:06:05 -0400 |
commit | 54b3e9eb10bebb33de799bc14616a0d72165583a (patch) | |
tree | 510401c43b716687589106dd268496c5b8a33781 /grep-printer | |
parent | 56e8864426229de7b181c141baddf788c22b4925 (diff) |
grep-printer: delete unused code
Diffstat (limited to 'grep-printer')
-rw-r--r-- | grep-printer/src/jsont.rs | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/grep-printer/src/jsont.rs b/grep-printer/src/jsont.rs index 5028349a..f98dabbb 100644 --- a/grep-printer/src/jsont.rs +++ b/grep-printer/src/jsont.rs @@ -114,39 +114,6 @@ impl<'a> Data<'a> { // so we do the easy thing for now. Data::Text { text: path.to_string_lossy() } } - - // Unused deserialization routines. - - /* - fn into_bytes(self) -> Vec<u8> { - match self { - Data::Text { text } => text.into_bytes(), - Data::Bytes { bytes } => bytes, - } - } - - #[cfg(unix)] - fn into_path_buf(&self) -> PathBuf { - use std::os::unix::ffi::OsStrExt; - - match self { - Data::Text { text } => PathBuf::from(text), - Data::Bytes { bytes } => { - PathBuf::from(OsStr::from_bytes(bytes)) - } - } - } - - #[cfg(not(unix))] - fn into_path_buf(&self) -> PathBuf { - match self { - Data::Text { text } => PathBuf::from(text), - Data::Bytes { bytes } => { - PathBuf::from(String::from_utf8_lossy(&bytes).into_owned()) - } - } - } - */ } fn to_base64<T, S>( @@ -178,36 +145,3 @@ where P: AsRef<Path>, { path.as_ref().map(|p| Data::from_path(p.as_ref())).serialize(ser) } - -// The following are some deserialization helpers, in case we decide to support -// deserialization of the above types. - -/* -fn from_base64<'de, D>( - de: D, -) -> Result<Vec<u8>, D::Error> -where D: Deserializer<'de> -{ - let encoded = String::deserialize(de)?; - let decoded = base64::decode(encoded.as_bytes()) - .map_err(D::Error::custom)?; - Ok(decoded) -} - -fn deser_bytes<'de, D>( - de: D, -) -> Result<Vec<u8>, D::Error> -where D: Deserializer<'de> -{ - Data::deserialize(de).map(|datum| datum.into_bytes()) -} - -fn deser_path<'de, D>( - de: D, -) -> Result<Option<PathBuf>, D::Error> -where D: Deserializer<'de> -{ - Option::<Data>::deserialize(de) - .map(|opt| opt.map(|datum| datum.into_path_buf())) -} -*/ |