Skip to content

Can't get rust_decimal::arbitrary_precision to work #169

@Scooter1337

Description

@Scooter1337

Serde_Json this returns value: 10.000,
Sonic_rs this returns value: 10

use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};

fn main() {
    let result: ArbitraryExample = sonic_rs::from_slice(b"{\"value\": 10.000}").unwrap();

    dbg!(result);
}

#[derive(Serialize, Deserialize, Debug)]
pub struct ArbitraryExample {
    #[serde(with = "rust_decimal::serde::arbitrary_precision")]
    value: Decimal,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions