pub struct Editor { /* private fields */ }
Expand description
Launches the default editor to edit a string.
§Example
use dialoguer::Editor;
if let Some(rv) = Editor::new().edit("Enter a commit message").unwrap() {
println!("Your message:");
println!("{}", rv);
} else {
println!("Abort!");
}
Implementations§
Source§impl Editor
impl Editor
Sourcepub fn executable<S: AsRef<OsStr>>(&mut self, val: S) -> &mut Self
pub fn executable<S: AsRef<OsStr>>(&mut self, val: S) -> &mut Self
Sets a specific editor executable.
Sourcepub fn require_save(&mut self, val: bool) -> &mut Self
pub fn require_save(&mut self, val: bool) -> &mut Self
Enables or disables the save requirement.
Sourcepub fn trim_newlines(&mut self, val: bool) -> &mut Self
pub fn trim_newlines(&mut self, val: bool) -> &mut Self
Enables or disables trailing newline stripping.
This is on by default.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Editor
impl RefUnwindSafe for Editor
impl Send for Editor
impl Sync for Editor
impl Unpin for Editor
impl UnwindSafe for Editor
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