Struct StrWriterMut

Source
pub struct StrWriterMut<'w, E = Utf8Encoding> { /* private fields */ }
Expand description

For writing a formatted string into a [u8].

§Construction

This type can be constructed in these ways:

§Relation to Formatter

This is the type that Formatter uses to write formatted text to a slice, sharing all the write_* methods, the difference is that this doesn’t store FormattingFlags, so you must pass them to the write_*_debug methods.

§Errors

Every single write_* method returns an Error::NotEnoughSpace if there is not enough space to write the argument, leaving the string itself unmodified.

§Encoding type parameter

The E type parameter represents the encoding of the buffer that this StrWriterMut writes into, currently only Utf8Encoding and NoEncoding are supported.

§Example

This example demonstrates how you can write a formatted string to a &mut [u8], using a StrWriterMut.


use const_format::{Error, StrWriterMut, try_, writec};

const fn format_number(number: u32,slice: &mut [u8]) -> Result<usize, Error> {
    let mut len = 0;
    let mut writer = StrWriterMut::from_custom_cleared(slice, &mut len);
     
    try_!(writec!(writer, "{0} in binary is {0:#b}", number));

    Ok(len)
}

let mut slice = [0; 32];

let len = format_number(100, &mut slice)?;

assert_eq!(&slice[..len], "100 in binary is 0b1100100".as_bytes());

Implementations§

Source§

impl<'w> StrWriterMut<'w, Utf8Encoding>

Source

pub const fn new(writer: &'w mut StrWriter) -> Self

Constructs a StrWriterMut from a mutable reference to a StrWriter

§Example
use const_format::{StrWriter, StrWriterMut};

let buffer: &mut StrWriter = &mut StrWriter::new([0; 128]);
{
    let mut writer = StrWriterMut::new(buffer);

    let _ = writer.write_str("Number: ");
    let _ = writer.write_u8_display(1);
}
assert_eq!(buffer.as_str(), "Number: 1");
Source§

impl<'w> StrWriterMut<'w, NoEncoding>

Source

pub const fn from_custom(buffer: &'w mut [u8], length: &'w mut usize) -> Self

Construct a StrWriterMut from length and byte slice mutable references.

If length > buffer.len() is passed, it’s simply assigned the length of the buffer.

§Example
use const_format::StrWriterMut;

let mut len = 6;
let mut buffer = *b"Hello,       ";

let mut writer = StrWriterMut::from_custom(&mut buffer, &mut len);

writer.write_str(" world!")?;

assert_eq!(writer.as_bytes(), b"Hello, world!");
assert_eq!(buffer, "Hello, world!".as_bytes());
assert_eq!(len, "Hello, world!".len());
Source§

impl<'w> StrWriterMut<'w, Utf8Encoding>

Source

pub const fn from_custom_cleared( buffer: &'w mut [u8], length: &'w mut usize, ) -> Self

Construct a StrWriterMut from length and byte slice mutable references, truncating the length to 0.

Using this instead of from_custom allows safely casting this to a &str with as_str_alt/as_str

§Example
use const_format::StrWriterMut;

let mut len = 0;
let mut buffer = [0; 13];

let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

writer.write_str("Hello, world!")?;

assert_eq!(writer.as_str(), "Hello, world!");
assert_eq!(buffer, "Hello, world!".as_bytes());
assert_eq!(len, "Hello, world!".len());
Source§

impl<'w, E> StrWriterMut<'w, E>

Source

pub const fn buffer(&self) -> &[u8]

Accesses the underlying buffer immutably.

§Example
use const_format::{StrWriter, StrWriterMut};

let mut buffer = StrWriter::new([0; 7]);
let mut writer = StrWriterMut::new(&mut buffer);
assert_eq!(writer.buffer(), &[0; 7]);

writer.write_str("foo")?;
assert_eq!(writer.buffer(), b"foo\0\0\0\0");

writer.write_str("bar")?;
assert_eq!(writer.buffer(), b"foobar\0");
Source

pub const fn len(&self) -> usize

The byte length of the string this is writing.

§Example
use const_format::{StrWriter, StrWriterMut};

let mut buffer = StrWriter::new([0; 64]);
let mut writer = StrWriterMut::new(&mut buffer);

assert_eq!(writer.len(), 0);

writer.write_str("foo")?;
assert_eq!(writer.len(), 3);

writer.write_str("bar")?;
assert_eq!(writer.len(), 6);
Source

pub const fn is_empty(&self) -> bool

Whether the string this is writing is empty.

§Example
use const_format::{StrWriter, StrWriterMut};

let mut buffer = StrWriter::new([0; 64]);
let mut writer = StrWriterMut::new(&mut buffer);

assert!( writer.is_empty() );

writer.write_str("foo")?;
assert!( !writer.is_empty() );
Source

pub const fn capacity(&self) -> usize

The maximum byte length of the formatted text for this StrWriterMut.

§Example
use const_format::{Error, StrWriter, StrWriterMut};

let mut buffer = StrWriter::new([0; 64]);
let mut writer = StrWriterMut::new(&mut buffer);

assert_eq!(writer.capacity(), 64);

writer.write_ascii_repeated(b'A', 64)?;
assert_eq!(writer.capacity(), 64);

assert_eq!(writer.write_str("-").unwrap_err(), Error::NotEnoughSpace);
assert_eq!(writer.capacity(), 64);
Source

pub const fn remaining_capacity(&self) -> usize

Checks how many more bytes can be written.

§Example
use const_format::{Error, StrWriter, StrWriterMut};

let mut buffer = StrWriter::new([0; 64]);
let mut writer = StrWriterMut::new(&mut buffer);

assert_eq!(writer.remaining_capacity(), 64);

writer.write_str("foo")?;
assert_eq!(writer.remaining_capacity(), 61);

writer.write_ascii_repeated(b'a', 61)?;
assert_eq!(writer.remaining_capacity(), 0);

assert_eq!(writer.write_str(" ").unwrap_err(), Error::NotEnoughSpace);
Source§

impl<'w> StrWriterMut<'w, Utf8Encoding>

Source

pub const fn truncate(&mut self, length: usize) -> Result<(), Error>

Truncates this StrWriterMut to length.

If length is greater than the current length, this does nothing.

§Errors

Returns an Error::NotOnCharBoundary if length is not on a char boundary.

§Example
use const_format::{Error, StrWriter, StrWriterMut};

let mut buffer = StrWriter::new([0; 64]);
let mut writer = StrWriterMut::new(&mut buffer);

writer.write_str("foo bâr baz");
assert_eq!(writer.as_str(), "foo bâr baz");

assert_eq!(writer.truncate(6).unwrap_err(), Error::NotOnCharBoundary);

writer.truncate(3)?;
assert_eq!(writer.as_str(), "foo");

writer.write_str("ooooooo");
assert_eq!(writer.as_str(), "fooooooooo");
Source§

impl<'w> StrWriterMut<'w, NoEncoding>

Source

pub const fn truncate(&mut self, length: usize)

Truncates this StrWriterMut<'w, NoEncoding> to length.

If length is greater than the current length, this does nothing.

§Example
use const_format::{Error, StrWriter, StrWriterMut};

let mut buffer = [0; 32];
let mut len = 0;
let mut writer = StrWriterMut::from_custom(&mut buffer, &mut len);

writer.write_str("foo bar baz");
assert_eq!(writer.as_bytes(), b"foo bar baz");

// Truncating to anything larger than the length is a no-op.
writer.truncate(usize::MAX / 2);
assert_eq!(writer.as_bytes(), b"foo bar baz");

writer.truncate(3);
assert_eq!(writer.as_bytes(), b"foo");

writer.write_str("ooooooo");
assert_eq!(writer.as_bytes(), b"fooooooooo");
Source§

impl<'w, E> StrWriterMut<'w, E>

Source

pub const fn clear(&mut self)

Truncates this StrWriterMut to length 0.

§Example
use const_format::{Error, StrWriter, StrWriterMut};

let mut buffer = StrWriter::new([0; 64]);
let mut writer = StrWriterMut::new(&mut buffer);

writer.write_str("foo")?;
assert_eq!(writer.as_str(), "foo");

writer.clear();
assert_eq!(writer.as_str(), "");
assert!(writer.is_empty());

writer.write_str("bar");
assert_eq!(writer.as_str(), "bar");
Source

pub const fn as_bytes_alt(&self) -> &[u8]

Gets the written part of this StrWriterMut as a &[u8]

The slice is guaranteed to be valid utf8, so this is mostly for convenience.

§Runtime

If the “rust_1_64” feature is disabled, this takes time proportional to self.capacity() - self.len().

If the “rust_1_64” feature is enabled, it takes constant time to run.

§Example

use const_format::{StrWriter, StrWriterMut};

let mut buffer = StrWriter::new([0; 64]);
let mut writer = StrWriterMut::new(&mut buffer);

writer.write_str("Hello, World!");

assert_eq!(writer.as_bytes_alt(), "Hello, World!".as_bytes());
Source§

impl<'w> StrWriterMut<'w, Utf8Encoding>

Source

pub const fn as_str_alt(&self) -> &str

Gets the written part of this StrWriterMut as a &str

§Runtime

If the “rust_1_64” feature is disabled, this takes time proportional to self.capacity() - self.len().

If the “rust_1_64” feature is enabled, it takes constant time to run.

§Example

use const_format::{StrWriter, StrWriterMut};
use const_format::{unwrap, writec};


const CAP: usize = 128;

const __STR: &StrWriter = &{
    let mut buffer =  StrWriter::new([0; CAP]);
    let mut writer = StrWriterMut::new(&mut buffer);

    // Writing the array with debug formatting, and the integers with hexadecimal formatting.
    unwrap!(writec!(writer, "{:X}", [3u32, 5, 8, 13, 21, 34]));

    buffer
};

const STR: &str = __STR.as_str_alt();

fn main() {
    assert_eq!(STR, "[3, 5, 8, D, 15, 22]");
}
Source

pub const fn as_str(&self) -> &str

Gets the written part of this StrWriterMut as a &str

§Constness

This can be called in const contexts by enabling the “rust_1_64” feature.

§Alternative

You can also use the as_str_alt method, which is always available, but takes linear time to run when the “rust_1_64” feature is disabled.

§Example

use const_format::{StrWriter, StrWriterMut};

let mut buffer = StrWriter::new([0; 64]);
let mut writer = StrWriterMut::new(&mut buffer);

writer.write_str("Hello, how are you?");

assert_eq!(writer.as_str(), "Hello, how are you?");
Source§

impl<'w, E> StrWriterMut<'w, E>

Source

pub const fn as_bytes(&self) -> &[u8]

Gets the written part of this StrWriterMut as a &[u8]

The slice is guaranteed to be valid utf8, so this is mostly for convenience.

§Constness

This can be called in const contexts by enabling the “rust_1_64” feature.

§Example

use const_format::{StrWriter, StrWriterMut};

let mut buffer = StrWriter::new([0; 64]);
let mut writer = StrWriterMut::new(&mut buffer);

writer.write_str("Hello, World!");

assert_eq!(writer.as_bytes_alt(), "Hello, World!".as_bytes());
Source§

impl<'w, E> StrWriterMut<'w, E>

Source

pub const fn make_formatter(&mut self, flags: FormattingFlags) -> Formatter<'_>

Constructs a Formatter that writes into this StrWriterMut, which can be passed to debug and display formatting methods.

§Example

use const_format::{Error, Formatter, FormattingFlags, StrWriter, StrWriterMut};
use const_format::call_debug_fmt;

use std::ops::Range;

const fn range_debug_fmt(
    slice: &[Range<usize>],
    f: &mut Formatter<'_>
) -> Result<(), Error> {
    // We need this macro to debug format arrays of non-primitive types
    // Also, it implicitly returns a `const_format::Error` on error.
    call_debug_fmt!(array, slice, f);
    Ok(())
}

let mut buffer = StrWriter::new([0; 64]);
let mut writer = StrWriterMut::new(&mut buffer);

range_debug_fmt(
    &[0..14, 14..31, 31..48],
    &mut writer.make_formatter(FormattingFlags::new().set_binary())
)?;
    
assert_eq!(writer.as_str(), "[0..1110, 1110..11111, 11111..110000]");

Source

pub const fn borrow_mutably(&mut self) -> &mut StrWriterMut<'w, E>

For borrowing this mutably in macros, without getting nested mutable references.

Source

pub const fn reborrow(&mut self) -> StrWriterMut<'_, E>

For passing a reborrow of this StrWriterMut into functions, without this you’d need to pass a mutable reference instead.

§Example

use const_format::{Error, FormattingFlags, StrWriter, StrWriterMut, call_debug_fmt};

use std::ops::Range;

const fn range_debug_fmt(
    slice: &[[u32; 2]],
    mut writer: StrWriterMut<'_>
) -> Result<(), Error> {
    let mut formatter = writer.make_formatter(FormattingFlags::new().set_binary());

    // We need this macro to debug format arrays of non-primitive types
    // Also, it implicitly returns a `const_format::Error` on error.
    call_debug_fmt!(array, slice, formatter);
    Ok(())
}

let mut buffer = StrWriter::new([0; 64]);
let mut writer = StrWriterMut::new(&mut buffer);

range_debug_fmt(&[[3, 5], [8, 13]], writer.reborrow())?;
    
assert_eq!(writer.as_str(), "[[11, 101], [1000, 1101]]");

Source§

impl<'w, E> StrWriterMut<'w, E>

Source

pub const fn write_str_range( &mut self, s: &str, range: Range<usize>, ) -> Result<(), Error>

Writes a subslice of s with Display formatting.

This is a workaround for being unable to do &foo[start..end] at compile time.

§Additional Errors

This method returns Error::NotOnCharBoundary if the range is not on a character boundary.

Out of bounds range bounds are treated as being at s.len(), this only returns an error on an in-bounds index that is not on a character boundary.

§Example
use const_format::{FormattingFlags, StrWriterMut};

let mut len = 0;
let mut buffer = [0; 64];
let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

let _ = writer.write_str_range("FOO BAR BAZ", 4..7);

assert_eq!(writer.as_str(), "BAR");
Source

pub const fn write_str(&mut self, s: &str) -> Result<(), Error>

Writes s with Display formatting.

§Example

use const_format::{FormattingFlags, StrWriterMut};

let mut len = 0;
let mut buffer = [0; 64];
let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

let _ = writer.write_str("FOO BAR BAZ");

assert_eq!(writer.as_str(), "FOO BAR BAZ");
Source

pub const fn write_char(&mut self, character: char) -> Result<(), Error>

Writes character with Display formatting

§Example

use const_format::StrWriterMut;

let mut len = 0;
let mut buffer = [0; 64];
let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

let _ = writer.write_char('3');
let _ = writer.write_char('5');
let _ = writer.write_char('8');

assert_eq!(writer.as_str(), "358");
Source

pub const fn write_ascii_range( &mut self, ascii: AsciiStr<'_>, range: Range<usize>, ) -> Result<(), Error>

Writes a subslice of ascii with Display formatting.

Out of bounds range bounds are treated as being at s.len().

This is a workaround for being unable to do &foo[start..end] at compile time.

§Example

use const_format::{FormattingFlags, StrWriterMut, ascii_str};

let mut len = 0;
let mut buffer = [0; 64];
let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

let _ = writer.write_ascii_range(ascii_str!("FOO BAR BAZ"), 4..7);

assert_eq!(writer.as_str(), "BAR");
Source

pub const fn write_ascii(&mut self, ascii: AsciiStr<'_>) -> Result<(), Error>

Writes ascii with Display formatting.

§Example

use const_format::{FormattingFlags, StrWriterMut, ascii_str};

let mut len = 0;
let mut buffer = [0; 64];
let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

let _ = writer.write_ascii(ascii_str!("FOO BAR BAZ"));

assert_eq!(writer.as_str(), "FOO BAR BAZ");
Source

pub const fn write_ascii_repeated( &mut self, character: u8, repeated: usize, ) -> Result<(), Error>

Writes an ascii character, repeated times.

§Example

use const_format::{FormattingFlags, StrWriterMut};

let mut len = 0;
let mut buffer = [0; 64];
let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

let _ = writer.write_ascii_repeated(b'A', 10);

assert_eq!(writer.as_str(), "AAAAAAAAAA");
Source§

impl<'w, E> StrWriterMut<'w, E>

Debug-formatted string writing

Source

pub const fn write_str_range_debug( &mut self, s: &str, range: Range<usize>, ) -> Result<(), Error>

Writes a subslice of s with Debug-like formatting.

This is a workaround for being unable to do &foo[start..end] at compile time.

§Additional Errors

This method returns Error::NotOnCharBoundary if the range is not on a character boundary.

Out of bounds range bounds are treated as being at s.len(), this only returns an error on an in-bounds index that is not on a character boundary.

§Example

use const_format::{FormattingFlags, StrWriterMut};

let mut len = 0;
let mut buffer = [0; 64];
let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

let _ = writer.write_str_range_debug("FOO\nBAR\tBAZ", 3..8);

assert_eq!(writer.as_str(), r#""\nBAR\t""#);
Source

pub const fn write_str_debug(&mut self, str: &str) -> Result<(), Error>

Writes s with Debug-like formatting.

§Example

use const_format::{FormattingFlags, StrWriterMut};

let mut len = 0;
let mut buffer = [0; 64];
let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

let _ = writer.write_str_debug("FOO\nBAR\tBAZ");

assert_eq!(writer.as_str(), r#""FOO\nBAR\tBAZ""#);
Source

pub const fn write_char_debug(&mut self, character: char) -> Result<(), Error>

Writes character with Debug formatting.

§Example

use const_format::StrWriterMut;

let mut len = 0;
let mut buffer = [0; 64];
let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

let _ = writer.write_str(" ");
let _ = writer.write_char_debug('\\');
let _ = writer.write_str(" ");
let _ = writer.write_char_debug('A');
let _ = writer.write_str(" ");
let _ = writer.write_char_debug('0');
let _ = writer.write_str(" ");
let _ = writer.write_char_debug('\'');
let _ = writer.write_str(" ");

assert_eq!(writer.as_str(), r#" '\\' 'A' '0' '\'' "#);
Source

pub const fn write_ascii_range_debug( &mut self, ascii: AsciiStr<'_>, range: Range<usize>, ) -> Result<(), Error>

Writes a subslice of ascii with Debug-like formatting.

Out of bounds range bounds are treated as being at s.len().

This is a workaround for being unable to do &foo[start..end] at compile time.

§Example

use const_format::{FormattingFlags, StrWriterMut, ascii_str};

let mut len = 0;
let mut buffer = [0; 64];
let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

let _ = writer.write_ascii_range_debug(ascii_str!("FOO\nBAR\tBAZ"), 3..8);

assert_eq!(writer.as_str(), r#""\nBAR\t""#);
Source

pub const fn write_ascii_debug( &mut self, ascii: AsciiStr<'_>, ) -> Result<(), Error>

Writes ascii with Debug-like formatting.

§Example

use const_format::{FormattingFlags, StrWriterMut, ascii_str};

let mut len = 0;
let mut buffer = [0; 64];
let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

let _ = writer.write_ascii_debug(ascii_str!("FOO\nBAR\tBAZ"));

assert_eq!(writer.as_str(), r#""FOO\nBAR\tBAZ""#);
Source§

impl<'w, E> StrWriterMut<'w, E>

Source

pub const fn write_u8_display(&mut self, number: u8) -> Result<(), Error>

Write number with display formatting.

§Example

use const_format::{Formatter, FormattingFlags, StrWriterMut, ascii_str};

let mut len = 0;
let mut buffer = [0; 64];
let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

let _ = writer.write_u8_display(137);

assert_eq!(writer.as_str(), "137");
Source

pub const fn write_u8_debug( &mut self, number: u8, flags: FormattingFlags, ) -> Result<(), Error>

Writes number with debug formatting.

§Example

use const_format::{FormattingFlags, StrWriterMut};

const fn debug_fmt<'a>(
    writer: &'a mut StrWriterMut<'_>,
    flag: FormattingFlags
) -> &'a str {
    writer.clear();
    let _ = writer.write_u8_debug(63, flag);
    writer.as_str_alt()
}

let reg_flag = FormattingFlags::NEW.set_alternate(false);
let alt_flag = FormattingFlags::NEW.set_alternate(true);

let mut len = 0;
let mut buffer = [0; 64];
let mut writer = StrWriterMut::from_custom_cleared(&mut buffer, &mut len);

assert_eq!(debug_fmt(&mut writer, reg_flag),                   "63"     );
assert_eq!(debug_fmt(&mut writer, reg_flag.set_hexadecimal()), "3F"     );
assert_eq!(debug_fmt(&mut writer, reg_flag.set_lower_hexadecimal()), "3f");
assert_eq!(debug_fmt(&mut writer, reg_flag.set_binary()),      "111111" );
assert_eq!(debug_fmt(&mut writer, alt_flag),                   "63"     );
assert_eq!(debug_fmt(&mut writer, alt_flag.set_hexadecimal()), "0x3F"   );
assert_eq!(debug_fmt(&mut writer, alt_flag.set_lower_hexadecimal()), "0x3f");
assert_eq!(debug_fmt(&mut writer, alt_flag.set_binary()),      "0b111111");
Source§

impl<'w, E> StrWriterMut<'w, E>

Source

pub const fn write_u16_display(&mut self, number: u16) -> Result<(), Error>

Writes number with display formatting

For an example, you can look at the one for the write_u8_display method.

Source

pub const fn write_u16_debug( &mut self, number: u16, flags: FormattingFlags, ) -> Result<(), Error>

Writes number with debug formatting.

For an example, you can look at the one for the write_u8_debug method.

Source

pub const fn write_u32_display(&mut self, number: u32) -> Result<(), Error>

Writes number with display formatting

For an example, you can look at the one for the write_u8_display method.

Source

pub const fn write_u32_debug( &mut self, number: u32, flags: FormattingFlags, ) -> Result<(), Error>

Writes number with debug formatting.

For an example, you can look at the one for the write_u8_debug method.

Source

pub const fn write_u64_display(&mut self, number: u64) -> Result<(), Error>

Writes number with display formatting

For an example, you can look at the one for the write_u8_display method.

Source

pub const fn write_u64_debug( &mut self, number: u64, flags: FormattingFlags, ) -> Result<(), Error>

Writes number with debug formatting.

For an example, you can look at the one for the write_u8_debug method.

Source

pub const fn write_u128_display(&mut self, number: u128) -> Result<(), Error>

Writes number with display formatting

For an example, you can look at the one for the write_u8_display method.

Source

pub const fn write_u128_debug( &mut self, number: u128, flags: FormattingFlags, ) -> Result<(), Error>

Writes number with debug formatting.

For an example, you can look at the one for the write_u8_debug method.

Source

pub const fn write_usize_display(&mut self, number: usize) -> Result<(), Error>

Writes number with display formatting

For an example, you can look at the one for the write_u8_display method.

Source

pub const fn write_usize_debug( &mut self, number: usize, flags: FormattingFlags, ) -> Result<(), Error>

Writes number with debug formatting.

For an example, you can look at the one for the write_u8_debug method.

Source

pub const fn write_i8_display(&mut self, number: i8) -> Result<(), Error>

Writes number with display formatting

For an example, you can look at the one for the write_u8_display method.

Source

pub const fn write_i8_debug( &mut self, number: i8, flags: FormattingFlags, ) -> Result<(), Error>

Writes number with debug formatting.

For an example, you can look at the one for the write_u8_debug method.

Source

pub const fn write_i16_display(&mut self, number: i16) -> Result<(), Error>

Writes number with display formatting

For an example, you can look at the one for the write_u8_display method.

Source

pub const fn write_i16_debug( &mut self, number: i16, flags: FormattingFlags, ) -> Result<(), Error>

Writes number with debug formatting.

For an example, you can look at the one for the write_u8_debug method.

Source

pub const fn write_i32_display(&mut self, number: i32) -> Result<(), Error>

Writes number with display formatting

For an example, you can look at the one for the write_u8_display method.

Source

pub const fn write_i32_debug( &mut self, number: i32, flags: FormattingFlags, ) -> Result<(), Error>

Writes number with debug formatting.

For an example, you can look at the one for the write_u8_debug method.

Source

pub const fn write_i64_display(&mut self, number: i64) -> Result<(), Error>

Writes number with display formatting

For an example, you can look at the one for the write_u8_display method.

Source

pub const fn write_i64_debug( &mut self, number: i64, flags: FormattingFlags, ) -> Result<(), Error>

Writes number with debug formatting.

For an example, you can look at the one for the write_u8_debug method.

Source

pub const fn write_i128_display(&mut self, number: i128) -> Result<(), Error>

Writes number with display formatting

For an example, you can look at the one for the write_u8_display method.

Source

pub const fn write_i128_debug( &mut self, number: i128, flags: FormattingFlags, ) -> Result<(), Error>

Writes number with debug formatting.

For an example, you can look at the one for the write_u8_debug method.

Source

pub const fn write_isize_display(&mut self, number: isize) -> Result<(), Error>

Writes number with display formatting

For an example, you can look at the one for the write_u8_display method.

Source

pub const fn write_isize_debug( &mut self, number: isize, flags: FormattingFlags, ) -> Result<(), Error>

Writes number with debug formatting.

For an example, you can look at the one for the write_u8_debug method.

Trait Implementations§

Source§

impl WriteMarker for StrWriterMut<'_>

Source§

type Kind = IsNotAStrWriter

Whether this is a StrWriter or not, this can be either of IsAStrWriter or IsNotAStrWriter
Source§

type This = StrWriterMut<'_>

The type after dereferencing, implemented as type This = Self; for all non-reference types

Auto Trait Implementations§

§

impl<'w, E> Freeze for StrWriterMut<'w, E>

§

impl<'w, E> RefUnwindSafe for StrWriterMut<'w, E>

§

impl<'w, E> Send for StrWriterMut<'w, E>

§

impl<'w, E> Sync for StrWriterMut<'w, E>

§

impl<'w, E> Unpin for StrWriterMut<'w, E>

§

impl<'w, E = Utf8Encoding> !UnwindSafe for StrWriterMut<'w, E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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: 24 bytes