pub struct Ed<'a, B: Buffer> { /* private fields */ }Expand description
The state variable used by the editor to track its internal state
Implementations
sourceimpl<'a, B: Buffer> Ed<'a, B>
impl<'a, B: Buffer> Ed<'a, B>
sourcepub fn new(buffer: &'a mut B, path: String) -> Result<Self, &'static str>
pub fn new(buffer: &'a mut B, path: String) -> Result<Self, &'static str>
Construct a new instance of Ed
- An empty file string is recommended if no filepath is opened
- Note that you can initialise the buffer with contents before this
sourcepub fn run_command(
&mut self,
ui: &mut dyn UI,
command: &str
) -> Result<bool, &'static str>
pub fn run_command(
&mut self,
ui: &mut dyn UI,
command: &str
) -> Result<bool, &'static str>
Run the given command
Returns true if the command was to quit
sourcepub fn run_macro(&mut self, ui: &mut dyn UI) -> Result<(), &'static str>
pub fn run_macro(&mut self, ui: &mut dyn UI) -> Result<(), &'static str>
Run given instance of Ed until it receives a command to quit or errors
The returned error type could be improved, suggestions welcome.
pub fn run(&mut self, ui: &mut dyn UI) -> Result<(), &'static str>
Auto Trait Implementations
impl<'a, B> RefUnwindSafe for Ed<'a, B> where
B: RefUnwindSafe,
impl<'a, B> Send for Ed<'a, B> where
B: Send,
impl<'a, B> Sync for Ed<'a, B> where
B: Sync,
impl<'a, B> Unpin for Ed<'a, B>
impl<'a, B> !UnwindSafe for Ed<'a, B>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more