pub struct Confirm { /* private fields */ }Implementations§
Source§impl Confirm
impl Confirm
Sourcepub fn new(label: &str) -> Self
pub fn new(label: &str) -> Self
Examples found in repository?
examples/confirm.rs (line 4)
3fn main() {
4 let confirmed = Confirm::new("Delete file?")
5 .color("red")
6 .bold(true)
7 .style("square")
8 .width(40)
9 .default(false)
10 .prompt();
11
12 if confirmed {
13 println!("File deleted.");
14 } else {
15 println!("Operation cancelled.");
16 }
17}Sourcepub fn default(self, value: bool) -> Self
pub fn default(self, value: bool) -> Self
Examples found in repository?
examples/confirm.rs (line 9)
3fn main() {
4 let confirmed = Confirm::new("Delete file?")
5 .color("red")
6 .bold(true)
7 .style("square")
8 .width(40)
9 .default(false)
10 .prompt();
11
12 if confirmed {
13 println!("File deleted.");
14 } else {
15 println!("Operation cancelled.");
16 }
17}Sourcepub fn color(self, color: &str) -> Self
pub fn color(self, color: &str) -> Self
Examples found in repository?
examples/confirm.rs (line 5)
3fn main() {
4 let confirmed = Confirm::new("Delete file?")
5 .color("red")
6 .bold(true)
7 .style("square")
8 .width(40)
9 .default(false)
10 .prompt();
11
12 if confirmed {
13 println!("File deleted.");
14 } else {
15 println!("Operation cancelled.");
16 }
17}Sourcepub fn bold(self, bold: bool) -> Self
pub fn bold(self, bold: bool) -> Self
Examples found in repository?
examples/confirm.rs (line 6)
3fn main() {
4 let confirmed = Confirm::new("Delete file?")
5 .color("red")
6 .bold(true)
7 .style("square")
8 .width(40)
9 .default(false)
10 .prompt();
11
12 if confirmed {
13 println!("File deleted.");
14 } else {
15 println!("Operation cancelled.");
16 }
17}Sourcepub fn style(self, style: &str) -> Self
pub fn style(self, style: &str) -> Self
Examples found in repository?
examples/confirm.rs (line 7)
3fn main() {
4 let confirmed = Confirm::new("Delete file?")
5 .color("red")
6 .bold(true)
7 .style("square")
8 .width(40)
9 .default(false)
10 .prompt();
11
12 if confirmed {
13 println!("File deleted.");
14 } else {
15 println!("Operation cancelled.");
16 }
17}Sourcepub fn width(self, width: usize) -> Self
pub fn width(self, width: usize) -> Self
Examples found in repository?
examples/confirm.rs (line 8)
3fn main() {
4 let confirmed = Confirm::new("Delete file?")
5 .color("red")
6 .bold(true)
7 .style("square")
8 .width(40)
9 .default(false)
10 .prompt();
11
12 if confirmed {
13 println!("File deleted.");
14 } else {
15 println!("Operation cancelled.");
16 }
17}Sourcepub fn prompt(&self) -> bool
pub fn prompt(&self) -> bool
Examples found in repository?
examples/confirm.rs (line 10)
3fn main() {
4 let confirmed = Confirm::new("Delete file?")
5 .color("red")
6 .bold(true)
7 .style("square")
8 .width(40)
9 .default(false)
10 .prompt();
11
12 if confirmed {
13 println!("File deleted.");
14 } else {
15 println!("Operation cancelled.");
16 }
17}Auto Trait Implementations§
impl Freeze for Confirm
impl RefUnwindSafe for Confirm
impl Send for Confirm
impl Sync for Confirm
impl Unpin for Confirm
impl UnwindSafe for Confirm
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