pub struct Notebook {
pub cells: Vec<Cell>,
pub metadata: NotebookMetadata,
pub nbformat: u32,
pub nbformat_minor: u32,
}Expand description
A Jupyter notebook
Fields§
§cells: Vec<Cell>Notebook cells
metadata: NotebookMetadataNotebook-level metadata
nbformat: u32nbformat version (major)
nbformat_minor: u32nbformat version (minor)
Implementations§
Source§impl Notebook
impl Notebook
Sourcepub fn from_file(path: &Path) -> Result<Self, NotebookError>
pub fn from_file(path: &Path) -> Result<Self, NotebookError>
Read a notebook from a file
Sourcepub fn to_string(&self) -> Result<String, NotebookError>
pub fn to_string(&self) -> Result<String, NotebookError>
Convert notebook to JSON string
Sourcepub fn get_cell_mut(&mut self, index: usize) -> Result<&mut Cell, NotebookError>
pub fn get_cell_mut(&mut self, index: usize) -> Result<&mut Cell, NotebookError>
Get a mutable cell by index
Sourcepub fn get_cells(&self, indices: &[usize]) -> Result<Vec<&Cell>, NotebookError>
pub fn get_cells(&self, indices: &[usize]) -> Result<Vec<&Cell>, NotebookError>
Get multiple cells by indices
Sourcepub fn cell_count(&self) -> usize
pub fn cell_count(&self) -> usize
Count cells
Sourcepub fn code_cell_count(&self) -> usize
pub fn code_cell_count(&self) -> usize
Count code cells
Sourcepub fn cell_timings(&self) -> Vec<CellTiming>
pub fn cell_timings(&self) -> Vec<CellTiming>
Get timing information for all cells
Returns a vector of CellTiming for all code cells that have timing metadata. Cells without timing metadata are skipped.
Sourcepub fn timing_summary(&self) -> Option<TimingSummary>
pub fn timing_summary(&self) -> Option<TimingSummary>
Get timing summary for the notebook
Returns timing statistics (total, average, min, max) for all cells with timing data. Returns None if no cells have timing metadata.
Sourcepub fn cells_with_timing_count(&self) -> usize
pub fn cells_with_timing_count(&self) -> usize
Count cells with timing metadata
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Notebook
impl<'de> Deserialize<'de> for Notebook
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Notebook
impl RefUnwindSafe for Notebook
impl Send for Notebook
impl Sync for Notebook
impl Unpin for Notebook
impl UnwindSafe for Notebook
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