ratatui_toolkit/primitives/toast/
mod.rs

1//! Toast notification component
2//!
3//! Provides toast notifications with different levels (success, error, info, warning).
4
5use std::time::{Duration, Instant};
6
7pub mod constructors;
8pub mod methods;
9
10/// Default toast display duration (3 seconds).
11pub const DEFAULT_TOAST_DURATION: Duration = Duration::from_secs(3);
12
13/// Toast notification level
14#[derive(Debug, Clone, Copy, PartialEq, Eq)]
15pub enum ToastLevel {
16    Success,
17    Error,
18    Info,
19    Warning,
20}
21
22/// A single toast notification
23#[derive(Debug, Clone)]
24pub struct Toast {
25    pub message: String,
26    pub level: ToastLevel,
27    pub created_at: Instant,
28    pub duration: Duration,
29}
30
31/// Manages multiple toast notifications
32#[derive(Debug, Default)]
33pub struct ToastManager {
34    toasts: Vec<Toast>,
35    max_toasts: usize,
36}