Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

quality of life tweaks after trying to use kernel sidecar in a plugin #33

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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