ratatui_toolkit/primitives/split_layout/methods/split_pane_horizontally.rs
1use crate::primitives::split_layout::PaneId;
2use crate::primitives::split_layout::SplitAxis;
3use crate::primitives::split_layout::SplitLayout;
4
5impl SplitLayout {
6 /// Splits a pane into a top and bottom pair.
7 ///
8 /// # Arguments
9 /// - `pane_id`: The pane to split.
10 ///
11 /// # Returns
12 /// The newly created pane ID when the split succeeds, or `None` when the
13 /// pane cannot be found.
14 ///
15 /// # Errors
16 /// - None.
17 ///
18 /// # Panics
19 /// - Does not panic.
20 ///
21 /// # Safety
22 /// - No safety requirements.
23 ///
24 /// # Performance
25 /// - O(n) to locate the pane.
26 ///
27 /// # Example
28 /// ```rust
29 /// use ratatui_toolkit::primitives::split_layout::SplitLayout;
30 ///
31 /// let mut layout = SplitLayout::new(0);
32 /// let _ = layout.split_pane_horizontally(0);
33 /// ```
34 pub fn split_pane_horizontally(&mut self, pane_id: PaneId) -> Option<PaneId> {
35 self.split_pane(pane_id, SplitAxis::Horizontal)
36 }
37}