ratatui-toolkit 0.2.6

DEPRECATED: this crate was renamed to `ratkit`. Please migrate to `ratkit`.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Get hierarchy method for CollapseState.

use crate::widgets::markdown_widget::state::CollapseState;

impl CollapseState {
    /// Get the hierarchy information for a section.
    ///
    /// # Arguments
    ///
    /// * `section_id` - The section ID to look up
    ///
    /// # Returns
    ///
    /// `Some((level, parent_id))` if the section exists, `None` otherwise.
    pub fn get_hierarchy(&self, section_id: usize) -> Option<(u8, Option<usize>)> {
        self.hierarchy.get(&section_id).copied()
    }
}