MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / pad_string

Function pad_string

compiler/src/modules/vm/handlers/format.rs:346–353  ·  view source on GitHub ↗
(s: &Spec, body: &str)

Source from the content-addressed store, hash-verified

344}
345
346fn pad_string(s: &Spec, body: &str) -> String {
347 let len = body.chars().count();
348 if len >= s.width { return body.to_string(); }
349 let pad = s.width - len;
350 // Strings can't use '=' alignment; a zero-fill default becomes left-align.
351 let align = match s.align.unwrap_or(b'<') { b'=' => b'<', a => a };
352 pad_with(body, pad, align, s.fill, 0)
353}
354
355fn pad_aligned(s: &Spec, body: &str, sign_prefix_len: usize) -> String {
356 let len = body.chars().count();

Callers 2

applyFunction · 0.85
format_floatFunction · 0.85

Calls 2

pad_withFunction · 0.85
countMethod · 0.80

Tested by

no test coverage detected