Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
mathis committed Oct 24, 2023
1 parent d9b1a3e commit d8cbdb4
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions server/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,6 @@ pub(crate) fn timestamp_now() -> u64 {
.as_secs()
}

// TODO: use serde_with's DisplayFromStr?
// pub(crate) fn serialize_display<T, S>(value: &T, serializer: S) -> Result<S::Ok, S::Error>
// where
// T: Display,
// S: Serializer,
// {
// serializer.collect_str(value)
// }

// pub(crate) mod serialize_partial_index {
// use serde::{de, Deserialize, Deserializer, Serializer};

// pub(crate) fn serialize<S: Serializer>(
// opt_index: &Option<Option<u16>>,
// serializer: S,
// ) -> Result<S::Ok, S::Error> {
// match opt_index {
// None => serializer.serialize_unit(),
// Some(None) => serializer.serialize_none(),
// Some(Some(v)) => serializer.serialize_some(&v.to_string()),
// }
// }

// pub(crate) fn deserialize<'de, D: Deserializer<'de>>(
// deserializer: D,
// ) -> Result<Option<Option<u16>>, D::Error> {
// let opt_name: Option<String> = Deserialize::deserialize(deserializer)?;
// let opt_index = match opt_name {
// Some(opt_name) => opt_name
// .split('_')
// .next()
// .ok_or(de::Error::invalid_value(
// de::Unexpected::Str(&opt_name),
// &"a mapdir-compatible resource index",
// ))?
// .parse::<u16>()
// .map(|v| Some(Some(v)))
// .map_err(de::Error::custom)?,
// None => Some(None),
// };
// Ok(opt_index)
// }
// }

pub(crate) mod macros {
macro_rules! apply_partial {
($src:expr => $tgt:expr, $($field:ident),*) => {{
Expand Down

0 comments on commit d8cbdb4

Please sign in to comment.