#core/fmt
Xu 0.16.0 API
import: #core/fmt
counts: 2 functions, 24 methods, 1 types, 0 constants, 0 method sets
Zero-allocation freestanding formatter writing directly into caller-supplied byte buffers (serial logs, stack buffers, panic messages, /proc text).
struct FmtBuf
pub struct FmtBuf {
pub buf *raw u8
pub cap usize
pub len usize
pub truncated u8
}
Purpose
Structure encapsulating buf, cap, len, truncated.
Public fields
buf *raw u8- buffer
cap usize- field (usize)
len usize- field (usize)
truncated u8- field (u8)
fmt_buf_new
pub fn fmt_buf_new(buf *raw u8, cap usize) FmtBuf
Purpose
Fmt buf new.
Parameters
buf *raw u8- buffer (*raw u8)
cap usize- cap (usize)
Returns
FmtBuf — a value of this type
fmt_buf_from_slice
pub fn fmt_buf_from_slice(s addr.MutByteSlice) FmtBuf
Purpose
Fmt buf from slice.
Parameters
s addr.MutByteSlice- s (addr.MutByteSlice)
Returns
FmtBuf — a value of this type
($&FmtBuf) reset
pub fn (f $&FmtBuf) reset()
Purpose
Operation on $&FmtBuf: clear internal state so the value can be reused.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
Returns
This call does not return a value.
(&FmtBuf) is_truncated
pub fn (f &FmtBuf) is_truncated() bool
Purpose
Operation on &FmtBuf: whether it is truncated.
Parameters
f &FmtBuf- The
FmtBuf instance used by this call (borrow).
Returns
bool — true or false
(&FmtBuf) remaining
pub fn (f &FmtBuf) remaining() usize
Purpose
Execute remaining on &FmtBuf.
Parameters
f &FmtBuf- The
FmtBuf instance used by this call (borrow).
Returns
usize — a value of this type
(&FmtBuf) as_slice
pub fn (f &FmtBuf) as_slice() addr.ByteSlice
Purpose
Operation on &FmtBuf: as slice.
Parameters
f &FmtBuf- The
FmtBuf instance used by this call (borrow).
Returns
addr.ByteSlice — a value of this type
($&FmtBuf) write_byte
pub fn (f $&FmtBuf) write_byte(b u8)
Purpose
Operation on $&FmtBuf: write one byte.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
b u8- b (u8)
Returns
This call does not return a value.
($&FmtBuf) write_bytes
pub fn (f $&FmtBuf) write_bytes(s &addr.ByteSlice)
Purpose
Operation on $&FmtBuf: write bytes.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
s &addr.ByteSlice- s (read-only borrow; caller keeps the original; type &addr.ByteSlice)
Returns
This call does not return a value.
($&FmtBuf) write_str
pub fn (f $&FmtBuf) write_str(s string)
Purpose
Operation on $&FmtBuf: write a string.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
s string- source string (string)
Returns
This call does not return a value.
($&FmtBuf) write_str_ref
pub fn (f $&FmtBuf) write_str_ref(s &string)
Purpose
Operation on $&FmtBuf: write str ref.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
s &string- source string (read-only borrow; caller keeps the original; type &string)
Returns
This call does not return a value.
($&FmtBuf) write_cstr
pub fn (f $&FmtBuf) write_cstr(ptr *raw u8, max_len usize)
Purpose
Operation on $&FmtBuf: write cstr.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
ptr *raw u8- ptr (*raw u8)
max_len usize- max_len (usize)
Returns
This call does not return a value.
($&FmtBuf) write_repeat
pub fn (f $&FmtBuf) write_repeat(b u8, count usize)
Purpose
Operation on $&FmtBuf: write repeat.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
b u8- b (u8)
count usize- count (usize)
Returns
This call does not return a value.
($&FmtBuf) write_bool
pub fn (f $&FmtBuf) write_bool(v bool)
Purpose
Operation on $&FmtBuf: write bool.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
v bool- value (bool)
Returns
This call does not return a value.
($&FmtBuf) write_u64
pub fn (f $&FmtBuf) write_u64(v u64)
Purpose
Operation on $&FmtBuf: write u64.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
v u64- value (u64)
Returns
This call does not return a value.
($&FmtBuf) write_i64
pub fn (f $&FmtBuf) write_i64(v i64)
Purpose
Operation on $&FmtBuf: write i64.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
v i64- value (i64)
Returns
This call does not return a value.
($&FmtBuf) write_usize
pub fn (f $&FmtBuf) write_usize(v usize)
Purpose
Operation on $&FmtBuf: write usize.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
v usize- value (usize)
Returns
This call does not return a value.
($&FmtBuf) write_isize
pub fn (f $&FmtBuf) write_isize(v isize)
Purpose
Operation on $&FmtBuf: write isize.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
v isize- value (isize)
Returns
This call does not return a value.
($&FmtBuf) write_hex_padded
pub fn (f $&FmtBuf) write_hex_padded(v u64, width usize, uppercase bool)
Purpose
Operation on $&FmtBuf: write hex padded.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
v u64- value (u64)
width usize- width (usize)
uppercase bool- uppercase (bool)
Returns
This call does not return a value.
($&FmtBuf) write_hex_u64
pub fn (f $&FmtBuf) write_hex_u64(v u64)
Purpose
Operation on $&FmtBuf: write hex u64.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
v u64- value (u64)
Returns
This call does not return a value.
($&FmtBuf) write_hex_upper_u64
pub fn (f $&FmtBuf) write_hex_upper_u64(v u64)
Purpose
Operation on $&FmtBuf: write hex upper u64.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
v u64- value (u64)
Returns
This call does not return a value.
($&FmtBuf) write_hex_prefixed
pub fn (f $&FmtBuf) write_hex_prefixed(v u64)
Purpose
Operation on $&FmtBuf: write hex prefixed.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
v u64- value (u64)
Returns
This call does not return a value.
($&FmtBuf) write_ptr
pub fn (f $&FmtBuf) write_ptr(p *raw u8)
Purpose
Operation on $&FmtBuf: write ptr.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
p *raw u8- p (*raw u8)
Returns
This call does not return a value.
($&FmtBuf) write_bin_u64
pub fn (f $&FmtBuf) write_bin_u64(v u64, min_bits usize)
Purpose
Operation on $&FmtBuf: write bin u64.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
v u64- value (u64)
min_bits usize- min_bits (usize)
Returns
This call does not return a value.
($&FmtBuf) nul_terminate
pub fn (f $&FmtBuf) nul_terminate() bool
Purpose
Operation on $&FmtBuf: nul terminate.
Parameters
f $&FmtBuf- The
FmtBuf instance used by this call (exclusive borrow).
Returns
bool — true or false
(&FmtBuf) eq_str
pub fn (f &FmtBuf) eq_str(s string) bool
Purpose
Operation on &FmtBuf: eq str.
Parameters
f &FmtBuf- The
FmtBuf instance used by this call (borrow).
s string- source string (string)
Returns
bool — true or false
(&FmtBuf) eq_str_ref
pub fn (f &FmtBuf) eq_str_ref(s &string) bool
Purpose
Operation on &FmtBuf: eq str ref.
Parameters
f &FmtBuf- The
FmtBuf instance used by this call (borrow).
s &string- source string (read-only borrow; caller keeps the original; type &string)
Returns
bool — true or false