Skip to content

Commit

Permalink
quality of life tweaks after trying to use kernel sidecar in a plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
kafonek committed Dec 25, 2023
1 parent 439d593 commit d8d4d66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/nb_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ impl NotebookBuilder {
self.nb.read().await.save(filename);
}

pub async fn dumps(&self) -> String {
self.nb.read().await.dumps()
}

pub async fn get_cell(&self, id: &str) -> Option<Cell> {
let nb = self.nb.read().await;
for cell in nb.cells.iter() {
Expand Down
4 changes: 4 additions & 0 deletions src/notebook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ impl Notebook {
let js = serde_json::to_string_pretty(&self).expect("Failed to serialize notebook on save");
std::fs::write(filename, js).unwrap();
}

pub fn dumps(&self) -> String {
serde_json::to_string_pretty(&self).expect("Failed to serialize notebook on save")
}
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, EnumAsInner)]
Expand Down

0 comments on commit d8d4d66

Please sign in to comment.