MCPcopy Index your code
hub / github.com/Lucretiel/lazy_format

github.com/Lucretiel/lazy_format @2.0.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.0.3 ↗ · + Follow
28 symbols 32 edges 2 files 1 documented · 4% updated 2y ago★ 1301 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Travis (.com) Crates.io docs.rs license

lazy_format

A [no_std] library for lazily formatting things. Because allocating temporary strings just to write them to a buffered stream is bad for your health.

use std::io;

use lazy_format::lazy_format;
use joinery::JoinableIterator;

fn main() {
    let result = (0..10)
        .map(|value| lazy_format!("\t'{}'", value))
        .join_with("\n")
        .to_string();

    assert_eq!(result,
"   '0'
    '1'
    '2'
    '3'
    '4'
    '5'
    '6'
    '7'
    '8'
    '9'")
}

The above example is the key motivating example: when building up some kind of object you wish to write or format, there's no reason to allocate intermediary strings (which is what format! does). Instead, lazy_format! captures its arguments and returns an opaque struct with a Display implementation, so that the actual formatting can happen directly into its final destination buffer (such as a file or string).

Core symbols most depended-on inside this repo

write_str
called by 0
src/lib.rs
write_fmt
called by 0
src/lib.rs

Shape

Function 18
Method 6
Class 4

Languages

Rust100%

Modules by API surface

tests/tests.rs22 symbols
src/lib.rs6 symbols

For agents

$ claude mcp add lazy_format \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page