safe_decimal_core 0.1.1

This is a Rust fixed-point numeric library targeting blockchain development. Originally created and used as a part of the Invariant Protocol. The current version leverages macros, traits and generics to exchange dozens of lines of error prone code with a single line and generating the rest.
Documentation
1
2
3
4
5
6
7
8
use proc_macro2::Span;
use syn::Ident;

pub fn string_to_ident(prefix: &str, name: &str) -> Ident {
    let mut denominator_const_name = String::from(prefix);
    denominator_const_name.push_str(name);
    Ident::new(denominator_const_name.as_str(), Span::call_site())
}