Enum fiberplane_models::notebooks::Cell
source · #[non_exhaustive]pub enum Cell {
Show 13 variants
Checkbox(CheckboxCell),
Code(CodeCell),
Discussion(DiscussionCell),
Divider(DividerCell),
Graph(GraphCell),
Heading(HeadingCell),
Image(ImageCell),
ListItem(ListItemCell),
Log(LogCell),
Provider(ProviderCell),
Table(TableCell),
Timeline(TimelineCell),
Text(TextCell),
}
Expand description
Representation of a single notebook cell.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Checkbox(CheckboxCell)
Code(CodeCell)
Discussion(DiscussionCell)
Divider(DividerCell)
Graph(GraphCell)
Heading(HeadingCell)
Image(ImageCell)
ListItem(ListItemCell)
Log(LogCell)
Provider(ProviderCell)
Table(TableCell)
Timeline(TimelineCell)
Text(TextCell)
Implementations§
source§impl Cell
impl Cell
sourcepub fn formatting(&self) -> Option<&Formatting>
pub fn formatting(&self) -> Option<&Formatting>
Returns the cell’s formatting, if any.
pub fn supports_formatting(&self) -> bool
sourcepub fn with_text(&self, text: impl Into<String>) -> Self
pub fn with_text(&self, text: impl Into<String>) -> Self
Returns a copy of the cell with its text replaced by the given text, without any formatting.
sourcepub fn with_rich_text(
&self,
text: impl Into<String>,
formatting: Formatting
) -> Self
pub fn with_rich_text( &self, text: impl Into<String>, formatting: Formatting ) -> Self
Returns a copy of the cell with its text replaced by the given text and formatting.
Warning: For cell types that have text, but which do not support rich-text, the formatting will be dropped silently.
sourcepub fn with_text_for_field<T>(
&self,
text: T,
formatting: Option<Formatting>,
field: Option<impl AsRef<str>>
) -> Selfwhere
T: Into<String> + AsRef<str>,
pub fn with_text_for_field<T>( &self, text: T, formatting: Option<Formatting>, field: Option<impl AsRef<str>> ) -> Selfwhere T: Into<String> + AsRef<str>,
Returns a copy of the cell with the text for the given field replaced by the given text and optional formatting.
If no field is given, the text is applied to the cell’s main text field,
similar to with_text()
or with_rich_text()
, depending on whether any
formatting is given.
Warning: For cell types that have text, but which do not support rich-text, any given formatting will be dropped silently.
pub fn id_mut(&mut self) -> &mut String
sourcepub fn formatting_mut(&mut self) -> Option<&mut Formatting>
pub fn formatting_mut(&mut self) -> Option<&mut Formatting>
Returns a mutable reference to the formatting array if the cell type supports formatting.