Skip to main content

Crate ratatui_toaster

Crate ratatui_toaster 

Source

Structs§

Toast
A simple widget that represents a toast message. It displays a message with a border colored according to the toast type.
ToastBuilder
A builder for creating a toast message. This struct allows you to specify the message content, type, position, and size constraints for a toast before showing it using the ToastEngine. The builder pattern provides a convenient way to configure the properties of a toast in a fluent manner.
ToastEngine
A toast engine for displaying temporary messages in a terminal UI. The ToastEngine manages the display of toasts, which are temporary messages that appear on the screen for a short duration. It supports different types of toasts (info, success, warning, error) and allows customization of their position and duration. You can call show_toast to display a toast, and hide_toast to hide the toast. To animate, you can get the area of the toast using toast_area and implement your animation logic based on that area. #[derive(Debug)] Caveat: If you’re not using the tokio feature, create a ToastEngine<()>. There is a (hacky) impl to make it work without the tokio feature.
ToastEngineBuilder
A builder for creating a ToastEngine. It allows you to set the default duration for toasts, and an optional channel sender for sending toast messages (if using the tokio feature).

Enums§

ToastConstraint
The constraint for the toast’s size. This enum defines how the size of the toast should be determined. The Auto variant allows the toast to automatically size itself based on the message content, while the Uniform and Manual variants allow for more specific control over the width and height of the toast.
ToastMessage
The messages that can be sent to the ToastEngine to control the display of toasts. The Show variant contains the message to display, the type of toast, and its position, while the Hide variant indicates that any currently displayed toast should be hidden.
ToastPosition
The position on the screen where the toast should be displayed. This enum defines various positions for toasts, including top-left, top-right, bottom-left, bottom-right, and center. The ToastEngine uses this information to calculate the appropriate area for rendering the toast based on the specified position.
ToastType
The type of toast to display. This enum defines the different types of toasts that can be shown, such as informational messages, success messages, warnings, and errors. Each variant can be styled differently when rendered.