refix-codegen 0.5.0

Typed message code generator for the ReFIX engine
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
/// An int-based value as a canonical literal, leading zeros dropped.
///
/// The resolver guarantees an optional `-` followed by digits.
pub(crate) fn int_literal(value: &str) -> String {
    let (sign, digits) = match value.strip_prefix('-') {
        Some(digits) => ("-", digits),
        None => ("", value),
    };
    match digits.trim_start_matches('0') {
        "" => "0".to_owned(),
        digits => format!("{sign}{digits}"),
    }
}