Skip to main content

ToastPosition

Enum ToastPosition 

Source
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 the End variants.
  • 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

Source

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());
Source

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

Source§

fn clone(&self) -> ToastPosition

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ToastPosition

Source§

impl Debug for ToastPosition

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ToastPosition

Source§

fn default() -> ToastPosition

Returns the “default value” for a type. Read more
Source§

impl Eq for ToastPosition

Source§

impl Hash for ToastPosition

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ToastPosition

Source§

fn eq(&self, other: &ToastPosition) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ToastPosition

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.