pub struct ListItem {
pub checked: Option<bool>,
pub content: String,
pub inline: Vec<InlineElement>,
pub blocks: Vec<ContentBlock>,
}Expand description
A list item with optional checkbox and nested content.
Fields§
§checked: Option<bool>For task lists: Some(true) = checked, Some(false) = unchecked, None = not a task
content: StringRaw text content of the item
inline: Vec<InlineElement>Parsed inline elements
blocks: Vec<ContentBlock>Nested blocks (e.g., code blocks, sub-lists inside list items)
Implementations§
Source§impl ListItem
impl ListItem
Sourcepub fn to_plain_text(&self) -> String
pub fn to_plain_text(&self) -> String
Extract plain text from this list item.
Returns the visible text content by joining inline elements. Includes nested block content recursively.
§Example
use turbovault_core::{ListItem, InlineElement};
let item = ListItem {
checked: Some(false),
content: "Todo item".to_string(),
inline: vec![InlineElement::Text { value: "Todo item".to_string() }],
blocks: vec![],
};
assert_eq!(item.to_plain_text(), "Todo item");Trait Implementations§
Source§impl<'de> Deserialize<'de> for ListItem
impl<'de> Deserialize<'de> for ListItem
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ListItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ListItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ListItem
impl Serialize for ListItem
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ListItem
Auto Trait Implementations§
impl Freeze for ListItem
impl RefUnwindSafe for ListItem
impl Send for ListItem
impl Sync for ListItem
impl Unpin for ListItem
impl UnwindSafe for ListItem
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