pub struct TomlIntegerFormat { /* private fields */ }
Expand description
Describes how a TOML integer should be formatted.
§Example
let format = toml_writer::TomlIntegerFormat::new().as_hex_lower();
let number = 10;
let number = format.format(number).unwrap_or(toml_writer::TomlInteger::new(number));
let number = number.to_toml_value();
assert_eq!(number, "0xa");
Implementations§
Source§impl TomlIntegerFormat
impl TomlIntegerFormat
Sourcepub fn as_decimal(self) -> Self
pub fn as_decimal(self) -> Self
Sets the format to decimal.
Sourcepub fn as_hex_upper(self) -> Self
pub fn as_hex_upper(self) -> Self
Sets the format to hexadecimal with all characters in uppercase.
Sourcepub fn as_hex_lower(self) -> Self
pub fn as_hex_lower(self) -> Self
Sets the format to hexadecimal with all characters in lowercase.
Sourcepub fn format<N: PartialOrd<i32>>(self, value: N) -> Option<TomlInteger<N>>where
TomlInteger<N>: WriteTomlValue,
pub fn format<N: PartialOrd<i32>>(self, value: N) -> Option<TomlInteger<N>>where
TomlInteger<N>: WriteTomlValue,
Formats value
as a TOML integer.
Returns None
if the value cannot be formatted
(e.g. value is negative and the radix is not decimal).
Trait Implementations§
Source§impl Clone for TomlIntegerFormat
impl Clone for TomlIntegerFormat
Source§fn clone(&self) -> TomlIntegerFormat
fn clone(&self) -> TomlIntegerFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TomlIntegerFormat
impl Debug for TomlIntegerFormat
Source§impl Default for TomlIntegerFormat
impl Default for TomlIntegerFormat
impl Copy for TomlIntegerFormat
Auto Trait Implementations§
impl Freeze for TomlIntegerFormat
impl RefUnwindSafe for TomlIntegerFormat
impl Send for TomlIntegerFormat
impl Sync for TomlIntegerFormat
impl Unpin for TomlIntegerFormat
impl UnwindSafe for TomlIntegerFormat
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte