MCPcopy Index your code
hub / github.com/endbasic/endbasic / refill_and_print

Function refill_and_print

std/src/console/format.rs:109–121  ·  view source on GitHub ↗

Same as `refill` but prints the lines of each paragraph to the console instead of returning them and prefixes them with an optional `indent`. The width is automatically determined from the console's size.

(
    console: &mut dyn Console,
    paragraphs: P,
    indent: &str,
)

Source from the content-addressed store, hash-verified

107///
108/// The width is automatically determined from the console's size.
109pub fn refill_and_print<S: AsRef<str>, P: IntoIterator<Item = S>>(
110 console: &mut dyn Console,
111 paragraphs: P,
112 indent: &str,
113) -> io::Result<()> {
114 // TODO(jmmv): This queries the size on every print, which is not very efficient. Should
115 // reuse this across calls, maybe by having a wrapper over Console and using it throughout.
116 let size = console.size_chars()?;
117 for line in refill_many(paragraphs, indent, usize::from(size.x)) {
118 console.print(&line)?;
119 }
120 Ok(())
121}
122
123/// Same as `refill` but prints the lines of each paragraph to a pager instead of returning
124/// them and prefixes them with an optional `indent`.

Callers 7

do_loginMethod · 0.85
async_execMethod · 0.85
run_from_storage_pathFunction · 0.85

Calls 3

refill_manyFunction · 0.85
size_charsMethod · 0.45
printMethod · 0.45