pub struct RoundToScaleSanitizer(pub u32);Expand description
Sanitizer that rounds rust_decimal::Decimal values to a specified scale.
§Example
use ic_dbms_api::prelude::{RoundToScaleSanitizer, Value, Sanitize as _};
use rust_decimal::Decimal;
let value = Value::Decimal(Decimal::new(123456, 4).into()); // 12.3456
let sanitizer = RoundToScaleSanitizer(2);
let sanitized_value = sanitizer.sanitize(value).unwrap();
assert_eq!(sanitized_value, Value::Decimal(Decimal::new(1235, 2).into())); // 12.35Tuple Fields§
§0: u32Trait Implementations§
Auto Trait Implementations§
impl Freeze for RoundToScaleSanitizer
impl RefUnwindSafe for RoundToScaleSanitizer
impl Send for RoundToScaleSanitizer
impl Sync for RoundToScaleSanitizer
impl Unpin for RoundToScaleSanitizer
impl UnwindSafe for RoundToScaleSanitizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more