destination 0.1.2

A library providing types and method for managing physical addresses in a municipality.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use serde::de::{Deserialize, Deserializer};

/// Deserialization function for the `floor` field of County addresses.  The County records single
/// floor buildings as floor zero, whereas the City records floor numbers for multistory buildings
/// and leaves the floor field empty for single story structures.
pub fn zero_floor<'de, D: Deserializer<'de>>(de: D) -> Result<Option<i64>, D::Error> {
    let intermediate = Deserialize::deserialize(de)?;

    match intermediate {
        0 => Ok(None),
        _ => Ok(Some(intermediate)),
    }
}