pub struct Program {
    pub filename: String,
    pub workspace: String,
    pub cells: HashMap<u32, Cell>,
}Expand description
This is what sits in state as long as the program is running
when a new request is made, it will check if the same cell has
been executed by checking cells which is a HashMap
§Terms
- temp_dir: Whatever the OS temp directory is
 - filename: Last executed filename so we can restart state if necessary
 - cells: VS Code name for a notebook cell
 
Fields§
§filename: String§workspace: String§cells: HashMap<u32, Cell>Implementations§
Source§impl Program
 
impl Program
Sourcepub fn create_cell(&mut self, cr: &CodeRequest)
 
pub fn create_cell(&mut self, cr: &CodeRequest)
Initial cell creation if it doesn’t exist yet Contents Use clone as we need to retain a pointer to data that will stick around after the request has finished
Sourcepub fn update_cell(&mut self, cr: &CodeRequest)
 
pub fn update_cell(&mut self, cr: &CodeRequest)
As the cells are implemented with a HashMap this is a fast lookup, Only updates what’s required
Sourcepub fn write_to_file(&mut self, fragment: u32)
 
pub fn write_to_file(&mut self, fragment: u32)
First sorts the hashmap by index into a vector, then writes the output with
rustkernel-start and rustkernel-end to determine which cell’s was executing
Sourcepub fn run(&self) -> String
 
pub fn run(&self) -> String
Run the program by running cargo run in the temp directory
then uses regex to determine what part of the output to send back
to the caller
pub fn fmt(&self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Program
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnwindSafe for Program
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