pub struct CsdBuilder { /* private fields */ }Expand description
Builder for CSD conversion operations with configurable options
§Examples
use csd::{CsdBuilder, CsdError, CsdResult};
let csd = CsdBuilder::new(28.5)
.places(4)
.max_non_zeros(3)
.build()?;
assert_eq!(csd, "+00-00.+");Implementations§
Source§impl CsdBuilder
impl CsdBuilder
Sourcepub fn new(value: f64) -> Self
pub fn new(value: f64) -> Self
Create a new CsdBuilder with the given value.
§Arguments
value- The decimal value to convert to CSD
Sourcepub fn places(self, places: i32) -> Self
pub fn places(self, places: i32) -> Self
Set the number of decimal places for the CSD output.
§Arguments
places- Number of decimal places (must be non-negative)
Sourcepub fn max_non_zeros(self, max_non_zeros: u32) -> Self
pub fn max_non_zeros(self, max_non_zeros: u32) -> Self
Set the maximum number of non-zero digits allowed.
§Arguments
max_non_zeros- Maximum number of non-zero digits in the output
Sourcepub fn rounding_strategy(self, strategy: RoundingStrategy) -> Self
pub fn rounding_strategy(self, strategy: RoundingStrategy) -> Self
Auto Trait Implementations§
impl Freeze for CsdBuilder
impl RefUnwindSafe for CsdBuilder
impl Send for CsdBuilder
impl Sync for CsdBuilder
impl Unpin for CsdBuilder
impl UnsafeUnpin for CsdBuilder
impl UnwindSafe for CsdBuilder
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