Panel

Struct Panel 

Source
pub struct Panel { /* private fields */ }

Implementations§

Source§

impl Panel

Source

pub fn new(content: impl Into<String>) -> Self

Examples found in repository?
examples/demo.rs (lines 296-300)
295fn print_panel_demo() {
296    let welcome_panel = Panel::new(
297        "Welcome to Pinax - a powerful terminal UI toolkit for Rust! \
298        This panel demonstrates text wrapping and border styling capabilities. \
299        Long text will automatically wrap to fit within the specified width.",
300    )
301    .with_title("Welcome")
302    .with_width(60);
303
304    let stats_panel = Panel::new(
305        "📈 Active Users: 1,234\n\
306         🔄 Server Uptime: 99.9%\n\
307         💾 Memory Usage: 2.1GB\n\
308         🚀 Response Time: 45ms",
309    )
310    .with_title("System Stats")
311    .with_width(30);
312
313    println!("\n📦 Panel Examples");
314    println!("===============");
315    println!("{}", welcome_panel);
316    println!("\n{}", stats_panel);
317}
Source

pub fn with_title(self, title: impl Into<String>) -> Self

Examples found in repository?
examples/demo.rs (line 301)
295fn print_panel_demo() {
296    let welcome_panel = Panel::new(
297        "Welcome to Pinax - a powerful terminal UI toolkit for Rust! \
298        This panel demonstrates text wrapping and border styling capabilities. \
299        Long text will automatically wrap to fit within the specified width.",
300    )
301    .with_title("Welcome")
302    .with_width(60);
303
304    let stats_panel = Panel::new(
305        "📈 Active Users: 1,234\n\
306         🔄 Server Uptime: 99.9%\n\
307         💾 Memory Usage: 2.1GB\n\
308         🚀 Response Time: 45ms",
309    )
310    .with_title("System Stats")
311    .with_width(30);
312
313    println!("\n📦 Panel Examples");
314    println!("===============");
315    println!("{}", welcome_panel);
316    println!("\n{}", stats_panel);
317}
Source

pub fn with_style(self, style: BorderStyle) -> Self

Source

pub fn with_width(self, width: usize) -> Self

Examples found in repository?
examples/demo.rs (line 302)
295fn print_panel_demo() {
296    let welcome_panel = Panel::new(
297        "Welcome to Pinax - a powerful terminal UI toolkit for Rust! \
298        This panel demonstrates text wrapping and border styling capabilities. \
299        Long text will automatically wrap to fit within the specified width.",
300    )
301    .with_title("Welcome")
302    .with_width(60);
303
304    let stats_panel = Panel::new(
305        "📈 Active Users: 1,234\n\
306         🔄 Server Uptime: 99.9%\n\
307         💾 Memory Usage: 2.1GB\n\
308         🚀 Response Time: 45ms",
309    )
310    .with_title("System Stats")
311    .with_width(30);
312
313    println!("\n📦 Panel Examples");
314    println!("===============");
315    println!("{}", welcome_panel);
316    println!("\n{}", stats_panel);
317}

Trait Implementations§

Source§

impl Display for Panel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Panel

§

impl RefUnwindSafe for Panel

§

impl Send for Panel

§

impl Sync for Panel

§

impl Unpin for Panel

§

impl UnwindSafe for Panel

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.