logos.mem.fmt

Module mem · package logos-mem

Traits

traitBinary

trait Binary

Binary formatting ({:b}); mirror of core::fmt::Binary.

Implemented by: u64 u32 u16 u8 usize i64 i32 i16 i8 isize

traitDebug

trait Debug

Developer-facing formatting ({:?} placeholders); mirror of core::fmt::Debug.

Implemented by: i8 i16 i32 i64 isize u8 u16 u32 u64 usize bool str f64 f32 void $tuple$variadic Option Result Vec String Ordering

traitDisplay

trait Display

User-facing formatting ({} placeholders); mirror of core::fmt::Display.

Implemented by: i8 i16 i32 i64 isize u8 u16 u32 u64 usize bool str *const u8 f64 f32 void String Ordering

traitFmtWrite

trait FmtWrite

Byte/string sink that formatters write into; mirror of core::fmt::Write.

Implemented by: String Formatter

traitLowerExp

trait LowerExp

Lowercase scientific-notation formatting ({:e}); mirror of core::fmt::LowerExp.

Implemented by: f64 f32

traitLowerHex

trait LowerHex

Lowercase hexadecimal formatting ({:x}); mirror of core::fmt::LowerHex.

Implemented by: u64 u32 u16 u8 usize i64 i32 i16 i8 isize

traitOctal

trait Octal

Octal formatting ({:o}); mirror of core::fmt::Octal.

Implemented by: u64 u32 u16 u8 usize i64 i32 i16 i8 isize

traitUpperExp

trait UpperExp

Uppercase scientific-notation formatting ({:E}); mirror of core::fmt::UpperExp.

Implemented by: f64 f32

traitUpperHex

trait UpperHex

Uppercase hexadecimal formatting ({:X}); mirror of core::fmt::UpperHex.

Implemented by: u64 u32 u16 u8 usize i64 i32 i16 i8 isize

Types

structArguments

struct Arguments

Placeholder mirror of core::fmt::Arguments; currently just carries the rendered text.

Fields

rendered: String

The already-formatted result string.

structDebugList

struct DebugList

Builder for list-shape Debug output ([a, b]); from Formatter::debug_list.

Fields

f: *mut Formatter

Backing formatter.

has_any: bool

Whether any entry has been written (drives comma emission).

result: Result

Running result returned by finish.

Methods

fn entry(self: &mut DebugList, value: &T) -> &mut DebugList

Appends one entry rendered via value’s Debug.

fn finish(self: &mut DebugList) -> Result

Closes with ] and returns the running result.

structDebugMap

struct DebugMap

Builder for map-shape Debug output ({k: v}); from Formatter::debug_map.

Fields

f: *mut Formatter

Backing formatter.

has_any: bool

Whether any entry has been written (drives comma emission).

result: Result

Running result returned by finish.

Methods

fn entry(self: &mut DebugMap, k: &K, v: &V) -> &mut DebugMap

Appends one k: v entry, rendering key and value via their Debug impls.

fn finish(self: &mut DebugMap) -> Result

Closes with } and returns the running result.

structDebugSet

struct DebugSet

Builder for set-shape Debug output ({a, b}); from Formatter::debug_set.

Fields

f: *mut Formatter

Backing formatter.

has_any: bool

Whether any entry has been written (drives comma emission).

result: Result

Running result returned by finish.

Methods

fn entry(self: &mut DebugSet, value: &T) -> &mut DebugSet

Appends one entry rendered via value’s Debug.

fn finish(self: &mut DebugSet) -> Result

Closes with } and returns the running result.

structDebugStruct

struct DebugStruct

Builder for struct-shape Debug output (Foo { x: 1 }); from Formatter::debug_struct.

Fields

f: *mut Formatter

Backing formatter.

has_fields: bool

Whether any field has been written (drives comma/brace emission).

result: Result

Running result returned by finish.

Methods

fn field(self: &mut DebugStruct, name: &[u8], value: &T) -> &mut DebugStruct

Appends one name: value field rendered via value’s Debug.

fn finish(self: &mut DebugStruct) -> Result

Closes the struct body (only if fields were written) and returns the running result.

fn finish_non_exhaustive(self: &mut DebugStruct) -> Result

Closes the body with a trailing .. marker (Foo { a: 1, .. } / Foo { .. }).

structDebugTuple

struct DebugTuple

Builder for tuple-shape Debug output (Foo(1, 2)); from Formatter::debug_tuple.

Fields

f: *mut Formatter

Backing formatter.

fields: i64

Count of fields written so far.

result: Result

Running result returned by finish.

Methods

fn field(self: &mut DebugTuple, value: &T) -> &mut DebugTuple

Appends one tuple field rendered via value’s Debug.

fn finish(self: &mut DebugTuple) -> Result

Closes with ) (only if fields were written) and returns the running result.

structError

struct Error

Unit error returned by failed formatter operations; carries no payload.

structFormatter

struct Formatter

Formatting state threaded through Display/Debug impls; mirror of core::fmt::Formatter. Bundles the output sink with the parsed spec of the current {...} placeholder.

Implements: FmtWrite

Fields

align_code: u8

Alignment code.

alternate: bool

Whether # (alternate form) was given.

fill: u8

Fill byte used for width padding (default ' ').

indent: i64

Pretty-print nesting depth; preserved across reset_spec.

precision: i64

Maximum content length.

sign_plus: bool

Whether + was given: force a sign on non-negative numbers.

w: &dyn FmtWrite

Output sink all writes go through.

width: i64

Minimum field width.

zero_pad: bool

Whether 0 (zero padding) was given.

Methods

fn as_formatter(self: &mut Formatter) -> Formatter
fn debug_list(self: &mut Formatter) -> DebugList

Creates a list-shape Debug builder, writing the opening [ immediately.

fn debug_map(self: &mut Formatter) -> DebugMap

Creates a map-shape Debug builder, writing the opening { immediately.

fn debug_set(self: &mut Formatter) -> DebugSet

Creates a set-shape Debug builder, writing the opening { immediately.

fn debug_struct(self: &mut Formatter, name: &[u8]) -> DebugStruct

Creates a struct-shape Debug builder, writing name immediately. Braces appear only once .field() is called (unit structs render as bare name).

fn debug_tuple(self: &mut Formatter, name: &[u8]) -> DebugTuple

Creates a tuple-shape Debug builder, writing name immediately.

fn indent_dec(self: &mut Formatter) -> void

Decrements the pretty-print nesting depth.

fn indent_inc(self: &mut Formatter) -> void

Increments the pretty-print nesting depth.

fn new(buf: &mut String) -> Formatter

Creates a default-spec Formatter over buf; static-call twin of formatter_for.

fn pad(self: &mut Formatter, content: &[u8], prefix: &[u8]) -> Result

Writes prefix then content applying the full spec: width, fill, alignment, precision, sign_plus, and zero padding; precision truncates content bytewise. Zero padding inserts 0s between sign/prefix and content ({:#05x}0x0ff).

fn reset_spec(self: &mut Formatter) -> void

Resets spec fields to no-format defaults; indent (nesting state) is preserved.

fn write_bool(self: &mut Formatter, b: bool) -> Result

Writes "true" or "false" through pad (spec applies).

fn write_char(self: &mut Formatter, c: u8) -> Result
fn write_indent(self: &mut Formatter) -> Result

Writes a newline followed by indent * 4 spaces.

fn write_int_dec_i64(self: &mut Formatter, n: i64) -> Result

Writes n in signed decimal through pad (spec applies).

fn write_int_dec_u64(self: &mut Formatter, n: u64) -> Result

Writes n in unsigned decimal through pad (spec applies).

fn write_int_radix_u64(self: &mut Formatter, n: u64, radix: u64, upper: bool) -> Result

Writes n in the given radix (2/8/16) through pad; upper selects A-F digits. Signless — callers mask signed values first. Alternate (#) adds 0x/0o/0b.

fn write_str(self: &mut Formatter, s: &[u8]) -> Result

Functions

fnerr

fn err() -> Result

Returns Err(Error {}), signalling formatter failure.

fnfmt_binary

fn fmt_binary(arg: &T, f: &mut Formatter) -> Result

Dispatches arg.fmt(f) through the Binary bound (resolves the shared fmt name).

fnfmt_debug

fn fmt_debug(arg: &T, f: &mut Formatter) -> Result

Dispatches arg.fmt(f) through the Debug bound (resolves the shared fmt name).

fnfmt_debug_to_string

fn fmt_debug_to_string(val: &T) -> String

Renders val via Debug into a new String using a default-spec Formatter.

fnfmt_display

fn fmt_display(arg: &T, f: &mut Formatter) -> Result

Dispatches arg.fmt(f) through the Display bound (resolves the shared fmt name).

fnfmt_display_to_string

fn fmt_display_to_string(val: &T) -> String

Renders val via Display into a new String using a default-spec Formatter.

fnfmt_lower_exp

fn fmt_lower_exp(arg: &T, f: &mut Formatter) -> Result

Dispatches arg.fmt(f) through the LowerExp bound (resolves the shared fmt name).

fnfmt_lower_hex

fn fmt_lower_hex(arg: &T, f: &mut Formatter) -> Result

Dispatches arg.fmt(f) through the LowerHex bound (resolves the shared fmt name).

fnfmt_octal

fn fmt_octal(arg: &T, f: &mut Formatter) -> Result

Dispatches arg.fmt(f) through the Octal bound (resolves the shared fmt name).

fnfmt_seq

fn fmt_seq(a: Result, b: Result) -> Result

Returns a if it is Err, else b; short-circuit step in mono-expanded tuple Debug chains.

fnfmt_tuple_close

fn fmt_tuple_close(f: &mut Formatter) -> Result

Writes the tuple-Debug closer ).

fnfmt_tuple_close1

fn fmt_tuple_close1(f: &mut Formatter) -> Result

Writes the 1-tuple closer ,).

fnfmt_tuple_open

fn fmt_tuple_open(f: &mut Formatter) -> Result

Writes the tuple-Debug opener (.

fnfmt_tuple_sep

fn fmt_tuple_sep(f: &mut Formatter) -> Result

Writes the tuple-Debug separator , .

fnfmt_upper_exp

fn fmt_upper_exp(arg: &T, f: &mut Formatter) -> Result

Dispatches arg.fmt(f) through the UpperExp bound (resolves the shared fmt name).

fnfmt_upper_hex

fn fmt_upper_hex(arg: &T, f: &mut Formatter) -> Result

Dispatches arg.fmt(f) through the UpperHex bound (resolves the shared fmt name).

fnformatter_for

fn formatter_for(buf: &mut String) -> Formatter

Creates a default-spec Formatter writing into buf.

fnformatter_for_sink

fn formatter_for_sink(sink: &dyn FmtWrite) -> Formatter

Creates a default-spec Formatter streaming into an arbitrary FmtWrite sink.

fnok

fn ok() -> Result

Returns Ok(()), the success value of a formatter operation.