[−][src]Struct num_format::format::CustomFormat
Type for representing your own custom formats.
Example
use num_format::errors::Error; use num_format::format::{CustomFormat, Grouping}; use num_format::Buffer; fn main() -> Result<(), Error> { let format = CustomFormat::builder() .grouping(Grouping::Indian) .minus_sign("--") .separator(Some('.')) .build()?; let mut buf = Buffer::new(); buf.write_formatted(&(-1000000), &format); assert_eq!("--10.00.000", buf.as_str()); Ok(()) }
Methods
impl CustomFormat[src]
pub fn builder() -> CustomFormatBuilder[src]
Constructs a CustomFormatBuilder.
pub fn into_builder(self) -> CustomFormatBuilder[src]
Turns self into a CustomFormatBuilder.
pub fn decimal(&self) -> char[src]
Returns this format's representation of decimal points.
pub fn grouping(&self) -> Grouping[src]
pub fn infinity(&self) -> &str[src]
Returns this format's representation of infinity.
pub fn minus_sign(&self) -> &str[src]
Returns this format's representation of minus signs.
pub fn nan(&self) -> &str[src]
Returns this format's representation of NaN.
pub fn separator(&self) -> Option<char>[src]
Returns this format's representation of separators.
Trait Implementations
impl Format for CustomFormat[src]
fn decimal(&self) -> char[src]
fn grouping(&self) -> Grouping[src]
fn infinity(&self) -> InfinityStr[src]
fn minus_sign(&self) -> MinusSignStr[src]
fn nan(&self) -> NanStr[src]
fn separator(&self) -> Option<char>[src]
impl Eq for CustomFormat[src]
impl Clone for CustomFormat[src]
fn clone(&self) -> CustomFormat[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Copy for CustomFormat[src]
impl PartialEq<CustomFormat> for CustomFormat[src]
fn eq(&self, other: &CustomFormat) -> bool[src]
fn ne(&self, other: &CustomFormat) -> bool[src]
impl From<CustomFormat> for CustomFormatBuilder[src]
fn from(format: CustomFormat) -> CustomFormatBuilder[src]
impl Hash for CustomFormat[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more
impl Debug for CustomFormat[src]
Auto Trait Implementations
impl Send for CustomFormat
impl Sync for CustomFormat
Blanket Implementations
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
impl<T> From for T[src]
impl<T, U> TryFrom for T where
U: Into<T>, [src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,