Merge pull request #4 from twistedfall/money_constructors

Improve usability of predefined Money constructors
This commit is contained in:
Edgar 2022-05-12 08:46:00 +02:00 committed by GitHub
commit 5ba6971b95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -77,7 +77,7 @@ pub struct Money {
macro_rules! impl_money { macro_rules! impl_money {
($name:ident, $type:expr) => { ($name:ident, $type:expr) => {
#[doc=concat!("Creates a instance of Money with the currency ", stringify!($type))] #[doc=concat!("Creates a instance of Money with the currency ", stringify!($type))]
pub fn $name(value: &str) -> Self { pub fn $name(value: impl ToString) -> Self {
Self { Self {
currency_code: $type, currency_code: $type,
value: value.to_string(), value: value.to_string(),