pub struct Constrain { /* private fields */ }Expand description
Constrain the width of a renderable to a given number of characters.
Implementations§
Source§impl Constrain
impl Constrain
Sourcepub fn new(renderable: impl Renderable + 'static, width: Option<usize>) -> Self
pub fn new(renderable: impl Renderable + 'static, width: Option<usize>) -> Self
Create a Constrain wrapper around any renderable.
If width is None, this is a pass-through wrapper (matches Python Rich behavior).
Sourcepub fn new_boxed(renderable: Box<dyn Renderable>, width: Option<usize>) -> Self
pub fn new_boxed(renderable: Box<dyn Renderable>, width: Option<usize>) -> Self
Create a Constrain wrapper around a boxed renderable.
Sourcepub fn new_measurable(
renderable: impl Renderable + RichMeasure + 'static,
width: Option<usize>,
) -> Self
pub fn new_measurable( renderable: impl Renderable + RichMeasure + 'static, width: Option<usize>, ) -> Self
Create a Constrain wrapper around a renderable that supports measurement.
Trait Implementations§
Source§impl Renderable for Constrain
impl Renderable for Constrain
Source§impl RichMeasure for Constrain
impl RichMeasure for Constrain
Source§fn rich_measure(
&self,
console: &Console,
options: &ConsoleOptions,
) -> Measurement
fn rich_measure( &self, console: &Console, options: &ConsoleOptions, ) -> Measurement
Measure minimum and maximum width requirements for a renderable.
Auto Trait Implementations§
impl Freeze for Constrain
impl !RefUnwindSafe for Constrain
impl !Send for Constrain
impl !Sync for Constrain
impl Unpin for Constrain
impl UnsafeUnpin for Constrain
impl !UnwindSafe for Constrain
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