pub struct Block {
pub lines: Vec<String>,
pub width: usize,
pub baseline: usize,
}Expand description
A 2D text block where every line has equal width. Supports vertical stacking, horizontal juxtaposition with baseline alignment, and delimiter wrapping — building blocks for block-mode Unicode rendering of matrices, fractions, delimited expressions, etc.
Fields§
§lines: Vec<String>§width: usize§baseline: usizeImplementations§
Source§impl Block
impl Block
pub fn from(s: &str) -> Block
pub fn empty() -> Block
pub fn render(&self) -> String
pub fn height(&self) -> usize
pub fn width(&self) -> usize
pub fn baseline(&self) -> usize
pub fn pad_to(&self, target_width: usize) -> Block
pub fn center(&self, target_width: usize) -> Block
Sourcepub fn above(&self, other: &Block) -> Block
pub fn above(&self, other: &Block) -> Block
Vertical concatenation. The narrower block is padded to match width.
Sourcepub fn beside(&self, other: &Block) -> Block
pub fn beside(&self, other: &Block) -> Block
Horizontal concatenation, aligning blocks at their baseline positions.
pub fn append_left(&self, label: &Block) -> Block
pub fn append_right(&self, label: &Block) -> Block
Trait Implementations§
impl Eq for Block
impl StructuralPartialEq for Block
Auto Trait Implementations§
impl Freeze for Block
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnsafeUnpin for Block
impl UnwindSafe for Block
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more