pub struct Formatter<'a, 'b> {
pub key: &'a str,
/* private fields */
}
Fields§
§key: &'a str
Implementations§
source§impl<'a, 'b> Formatter<'a, 'b>
impl<'a, 'b> Formatter<'a, 'b>
implement formatting of strings
sourcepub fn str_unchecked(&mut self, s: &str) -> Result<()>
pub fn str_unchecked(&mut self, s: &str) -> Result<()>
UNSTABLE+UNTESTED: do not use in your own code (yet)
Do the same as str
but do not check the format string for errors.
This gives a moderate performance boost.
This isn’t exactly unsafe, it just ends up ignoring extranious format
specifiers
For example, {x:<-#10} should technically be formatting an int, but ignoring the
integer specific formatting is probably not the end of the world
This can also be used by the u64
etc methods to finish their formatting while
still using the str formatter for width and alignment
source§impl<'a, 'b> Formatter<'a, 'b>
impl<'a, 'b> Formatter<'a, 'b>
sourcepub fn from_str(s: &'a str, buff: &'b mut String) -> Result<Formatter<'a, 'b>>
pub fn from_str(s: &'a str, buff: &'b mut String) -> Result<Formatter<'a, 'b>>
create Formatter from format string
sourcepub fn skip(self) -> Result<()>
pub fn skip(self) -> Result<()>
call this to re-write the original format string verbatum back to the output
pub fn set_default_align(&mut self, align: Alignment)
sourcepub fn set_precision(&mut self, precision: Option<usize>)
pub fn set_precision(&mut self, precision: Option<usize>)
set precision to None, used for formatting int, float, etc
sourcepub fn sign_minus(&self) -> bool
pub fn sign_minus(&self) -> bool
sign minus getter here because it is in fmt::Formatter
sourcepub fn is_int_type(&self) -> bool
pub fn is_int_type(&self) -> bool
UNSTABLE: in the future, this may return true if all validty checks for a float return true return true if ty is valid for formatting integers
sourcepub fn is_float_type(&self) -> bool
pub fn is_float_type(&self) -> bool
UNSTABLE: in the future, this may return true if all validty checks for a float return true return true if ty is valid for formatting floats