Toast
显示定时堆叠通知,支持操作、关闭和滑动手势。
正在加载交互演示…
toast_viewport("toasts").child(text("Saved"))#导入
从 quickgui 导入 Toast。
use quickgui::*;#用法
toast_viewport("toasts").child(text("Saved"))#结构
Toast::provider_partToast::portalToast::viewportToast::positionerToast::rootToast::contentToast::titleToast::descriptionToast::actionToast::close
#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
Toast
查看源码pub fn new(title: impl Into<Arc<str>>) -> SelfCreate a toast with an auto-dismiss duration of five seconds.
descriptionpub fn description(mut self, description: impl Into<Arc<str>>) -> Self—
Configures description for this part.
pub fn description(mut self, description: impl Into<Arc<str>>) -> Self查看源码actionpub fn action(mut self, action: impl Into<Arc<str>>) -> Self—
Label one caller-owned action control, such as *Undo*.
pub fn action(mut self, action: impl Into<Arc<str>>) -> Self查看源码kindpub const fn kind(mut self, kind: ToastKind) -> Self—
durationpub fn duration(mut self, duration: Duration) -> Self—
Replace the auto-dismiss duration, clamped to [`MAX_TOAST_DURATION`].
pub fn duration(mut self, duration: Duration) -> Self查看源码persistentpub const fn persistent(mut self) -> Self—
titlepub fn title(&self) -> &Arc<str>—
description_textpub fn description_text(&self) -> Option<&Arc<str>>—
action_labelpub fn action_label(&self) -> Option<&Arc<str>>—
toast_kindpub const fn toast_kind(&self) -> ToastKind—
duration_valuepub const fn duration_value(&self) -> Option<Duration>—
toast_viewport
查看源码pub fn toast_viewport(id: impl Into<ElementId>) -> ElementCreate an unstyled toast-viewport root. This shorthand is equivalent to `ToastViewport::new(id).viewport_with(div())`.
