Struct Toasts

Source
pub struct Toasts { /* private fields */ }

Implementations§

Source§

impl Toasts

Source

pub fn new() -> Self

Source

pub fn with_id(id: Id) -> Self

Create a new Toasts instance with a custom id

This can be useful if you want to have multiple toast groups in the same UI.

Source

pub fn position(self, position: impl Into<Pos2>) -> Self

Position where the toasts show up.

The toasts will start from this position and stack up in the direction specified with Self::direction.

Source

pub fn anchor(self, anchor: Align2, offset: impl Into<Pos2>) -> Self

Anchor for the toasts.

For instance, if you set this to (10.0, 10.0) and Align2::LEFT_TOP, then (10.0, 10.0) will be the top-left corner of the first toast.

Source

pub fn direction(self, direction: impl Into<Direction>) -> Self

Direction where the toasts stack up

Source

pub fn custom_contents( self, kind: impl Into<ToastKind>, add_contents: impl Fn(&mut Ui, &mut Toast) -> Response + Send + Sync + 'static, ) -> Self

Can be used to specify a custom rendering function for toasts for given kind

Source

pub fn add(&mut self, toast: Toast) -> &mut Self

Add a new toast

Source

pub fn show(&mut self, ctx: &Context)

Show and update all toasts

Trait Implementations§

Source§

impl Default for Toasts

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Toasts

§

impl !RefUnwindSafe for Toasts

§

impl Send for Toasts

§

impl Sync for Toasts

§

impl Unpin for Toasts

§

impl !UnwindSafe for Toasts

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.