pub struct MessageBox { /* private fields */ }Expand description
A builder struct to create a MessageBox.
§Examples
Standard Window:
use system_extensions::dialogues::messagebox::{MessageBox, BoxReturn};
let result = MessageBox::new("My Title", "The content of the message box!").show();
if result.unwrap() == BoxReturn::OK {
println!("The user acknowledge the message!");
}Window with Icon:
use system_extensions::dialogues::messagebox::{MessageBox, BoxReturn, IconType};
let result = MessageBox::new("My Title", "The content of the message box!")
.set_icon_type(IconType::ICON_ERROR)
.show();
if result.unwrap() == BoxReturn::OK {
println!("The user acknowledge the error!");
}Implementations§
Source§impl MessageBox
impl MessageBox
Sourcepub fn new(title: &'static str, content: &'static str) -> MessageBox
pub fn new(title: &'static str, content: &'static str) -> MessageBox
Sourcepub fn set_content(&mut self, content: &'static str) -> &mut Self
pub fn set_content(&mut self, content: &'static str) -> &mut Self
Sourcepub fn set_window_type(&mut self, window_type: WindowType) -> &mut Self
pub fn set_window_type(&mut self, window_type: WindowType) -> &mut Self
Set the type of the MessageBox. (The Buttons that are shown).
§Params
window_type: WindowType -> The WindowType to set.
§Returns
A mutable instance of the MessageBox.
Sourcepub fn set_icon_type(&mut self, icon_type: IconType) -> &mut Self
pub fn set_icon_type(&mut self, icon_type: IconType) -> &mut Self
Set the default button for the MessageBox.
§Params
default_button: DefaultButton -> The default button of the MessageBox.
§Returns
A mutable instance of the MessageBox.
Trait Implementations§
Source§impl Clone for MessageBox
impl Clone for MessageBox
Source§fn clone(&self) -> MessageBox
fn clone(&self) -> MessageBox
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MessageBox
impl Debug for MessageBox
impl Copy for MessageBox
Auto Trait Implementations§
impl Freeze for MessageBox
impl RefUnwindSafe for MessageBox
impl Send for MessageBox
impl Sync for MessageBox
impl Unpin for MessageBox
impl UnsafeUnpin for MessageBox
impl UnwindSafe for MessageBox
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more