fn as_api_option<T: Num>(n: T) -> Option<T> {
    if n.is_zero() {
        None
    } else {
        Some(n)
    }
}
// Conversion from 0 to None, to skip serialization.
// The API doesn't accept 0 as numeric value (contrary to stated in docs),
// and seems to map "not existent key" to 0 (at least for some fields), so we convert explicitly 0 to None.
// Note that this function is needed only for values which can be meaningfully 0 in the domain
// (otherwise they should be represented as None everywhere)
// Intentionally not using serde's skip for anything other than Option, for consistency.
// related: https://github.com/algorand/docs/pull/454, https://github.com/algorand/docs/issues/415
Conversion from 0 to None, to skip serialization.
The API doesn't accept 0 as numeric value (contrary to stated in docs),
and seems to map "not existent key" to 0 (at least for some fields), so we convert explicitly 0 to None.
Note that this function is needed only for values which can be meaningfully 0 in the domain
(otherwise they should be represented as None everywhere)
Intentionally not using serde's skip for anything other than Option, for consistency.
Conversion from 0 to None to skip serialization . The API doesn ' t accept 0 as numeric value ( contrary to stated in docs ) and seems to map " not existent key " to 0 ( at least for some fields ) so we convert explicitly 0 to None . Note that this function is needed only for values which can be meaningfully 0 in the domain ( otherwise they should be represented as None everywhere ) Intentionally not using serde ' s skip for anything other than Option for consistency .
fn as_api_option<T: Num>(n: T) -> Option<T> {
    if n.is_zero() {
        None
    } else {
        Some(n)
    }
}
fn as_api_option < T : Num > ( n : T ) -> Option < T > { if n . is_zero ( ) { None } else { Some ( n ) } }
Conversion from 0 to None, to skip serialization.
Conversion from 0 to None to skip serialization .
n
T
n
T