Trait Program

Source
pub trait Program {
    // Required methods
    fn is_dirty(&self) -> bool;
    fn edit<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        console: &'life1 mut dyn Console,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn load(&mut self, name: Option<&str>, text: &str);
    fn name(&self) -> Option<&str>;
    fn set_name(&mut self, name: &str);
    fn text(&self) -> String;
}
Expand description

Representation of the single program that we can keep in memory.

Required Methods§

Source

fn is_dirty(&self) -> bool

Returns true if the program was modified since it was last saved (as indicated by a call to set_name).

Source

fn edit<'life0, 'life1, 'async_trait>( &'life0 mut self, console: &'life1 mut dyn Console, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Edits the program interactively via the given console.

Source

fn load(&mut self, name: Option<&str>, text: &str)

Reloads the contents of the stored program with the given text and tracks them as coming from the file given in name.

Source

fn name(&self) -> Option<&str>

Path of the loaded program. Should be None if the program has never been saved yet.

Source

fn set_name(&mut self, name: &str)

Resets the name of the program. Used when saving it.

Source

fn text(&self) -> String

Gets the contents of the stored program as a single string.

Implementors§