ratatui_toolkit/primitives/toast/constructors/
toast_with_duration.rs

1use crate::primitives::toast::{Toast, ToastLevel};
2use std::time::Duration;
3
4impl Toast {
5    pub fn with_duration(
6        message: impl Into<String>,
7        level: ToastLevel,
8        duration: Duration,
9    ) -> Self {
10        Self {
11            message: message.into(),
12            level,
13            created_at: std::time::Instant::now(),
14            duration,
15        }
16    }
17}