MCPcopy Index your code
hub / github.com/RustPython/RustPython / py_center

Method py_center

crates/vm/src/anystr.rs:290–294  ·  view source on GitHub ↗
(&self, width: usize, fillchar: Self::Char, len: usize)

Source from the content-addressed store, hash-verified

288 }
289
290 fn py_center(&self, width: usize, fillchar: Self::Char, len: usize) -> Self::Container {
291 let marg = width - len;
292 let left = marg / 2 + (marg & width & 1);
293 self.py_pad(left, marg - left, fillchar)
294 }
295
296 fn py_ljust(&self, width: usize, fillchar: Self::Char, len: usize) -> Self::Container {
297 self.py_pad(0, width - len, fillchar)

Callers

nothing calls this directly

Implementers 2

bytes_inner.rscrates/vm/src/bytes_inner.rs
str.rscrates/vm/src/builtins/str.rs

Calls 1

py_padMethod · 0.80

Tested by

no test coverage detected