pub enum ToastPosition {
TopEnd,
TopStart,
TopCenter,
BottomEnd,
BottomStart,
BottomCenter,
}Expand description
Where the toast stack anchors within the window.
Positions are expressed in logical terms (Start / End) along the
horizontal axis, so they automatically mirror under
crate::LayoutDirection::Rtl without per-application changes — the
same ABDD principle that governs sidebars and header end-controls.
§Choosing a position
TopEnd(default) — top-right under LTR, top-left under RTL. Recommended for application-internal notifications because the bottom half of the window is typically reserved for primary content (previews, editors, lists).BottomEnd— bottom-right under LTR. Matches the OS-level notification center convention on macOS / GNOME / Windows.TopStart/BottomStart— opposite horizontal edges from theEndvariants.TopCenter/BottomCenter— centered horizontally. Useful for modal-feeling messages.
§Stack growth direction
New toasts are inserted so that the most recent toast is closest to the anchor edge:
Top*: new toasts appear below older ones; the newest sits closest to the top edge.Bottom*: new toasts appear above older ones; the newest sits closest to the bottom edge.
The engine is responsible for honoring this invariant; applications
only push to the back of their Vec<Toast<_>> in chronological order.
Variants§
TopEnd
LTR=top-right, RTL=top-left. The default.
TopStart
LTR=top-left, RTL=top-right.
TopCenter
Horizontally centered, anchored to the top edge.
BottomEnd
LTR=bottom-right, RTL=bottom-left.
BottomStart
LTR=bottom-left, RTL=bottom-right.
BottomCenter
Horizontally centered, anchored to the bottom edge.
Implementations§
Source§impl ToastPosition
impl ToastPosition
Sourcepub fn is_top(self) -> bool
pub fn is_top(self) -> bool
Whether this position anchors to the top edge of the window. Engines use this to decide stack growth direction (top anchors grow downward; bottom anchors grow upward).
§Example
use snora_core::ToastPosition;
assert!(ToastPosition::TopEnd.is_top());
assert!(ToastPosition::TopCenter.is_top());
assert!(!ToastPosition::BottomEnd.is_top());Sourcepub fn is_bottom(self) -> bool
pub fn is_bottom(self) -> bool
Whether this position anchors to the bottom edge of the window.
Always the inverse of Self::is_top.
Trait Implementations§
Source§impl Clone for ToastPosition
impl Clone for ToastPosition
Source§fn clone(&self) -> ToastPosition
fn clone(&self) -> ToastPosition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more