The most basic of starts. Sets up a super basic App to create, update, and execute cells. Nothing fancy.
Introductory Structures
Notebook contains a HashMap of Cell objects and a Vec for maintaining the order of cells.
Cell represents a single cell in the notebook, containing an id and content.
AppState holds a Mutex<HashMap> mapping from a Tauri Window to Notebook.
AppState
This is global app state for Tauri that allows us to create notebooks and run commands specific to a notebook that matches up to a window.
new: Creates a new AppState with an empty notebooks HashMap.
create_notebook: Creates a new Notebook and adds it to the notebooksHashMap.
execute_cell: Attempts to execute a cell in a specific notebook.
create_cell: Creates a new cell in a specific notebook.
update_cell: Updates the content of a specific cell in a specific notebook.
Each of these operations are set up as Tauri commands. I didn't check to see if I could declare these functions as the commands themselves. That would probably be cleaner and reduce the boilerplate.
Notebook
execute_cell: Executes a cell (currently not implemented).
create_cell: Creates a new cell with a unique ID and empty content.
update_cell: Updates the content of a specific cell.
The most basic of starts. Sets up a super basic App to create, update, and execute cells. Nothing fancy.
Introductory Structures
Notebook
contains aHashMap
ofCell
objects and aVec
for maintaining the order of cells.Cell
represents a single cell in the notebook, containing anid
andcontent
.AppState
holds aMutex<HashMap>
mapping from a TauriWindow
toNotebook
.AppState
This is global app state for Tauri that allows us to create notebooks and run commands specific to a notebook that matches up to a window.
new
: Creates a newAppState
with an empty notebooksHashMap
.create_notebook
: Creates a newNotebook
and adds it to thenotebooks
HashMap
.execute_cell
: Attempts to execute a cell in a specific notebook.create_cell
: Creates a new cell in a specific notebook.update_cell
: Updates the content of a specific cell in a specific notebook.Each of these operations are set up as Tauri commands. I didn't check to see if I could declare these functions as the commands themselves. That would probably be cleaner and reduce the boilerplate.
Notebook
execute_cell
: Executes a cell (currently not implemented).create_cell
: Creates a new cell with a unique ID and empty content.update_cell
: Updates the content of a specific cell.