refactor!: remove get_identifier_without_leaf
remove as its no longer used either internally or in mqttui for some time. Either its quickly implemented yourself or `Vec::pop()` does the job better.
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
/// Split an `Identifier` into its branch and leaf.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tui_tree_widget::get_identifier_without_leaf;
|
||||
/// let (branch, leaf) = get_identifier_without_leaf(&[2, 4, 6]);
|
||||
/// assert_eq!(branch, [2, 4]);
|
||||
/// assert_eq!(leaf, Some(&6));
|
||||
///
|
||||
/// let (branch, leaf) = get_identifier_without_leaf(&[2]);
|
||||
/// assert_eq!(branch, []);
|
||||
/// assert_eq!(leaf, Some(&2));
|
||||
///
|
||||
/// let (branch, leaf) = get_identifier_without_leaf::<usize>(&[]);
|
||||
/// assert_eq!(branch, []);
|
||||
/// assert_eq!(leaf, None);
|
||||
/// ```
|
||||
#[must_use]
|
||||
pub const fn get_without_leaf<Identifier>(
|
||||
identifier: &[Identifier],
|
||||
) -> (&[Identifier], Option<&Identifier>) {
|
||||
match identifier {
|
||||
[branch @ .., leaf] => (branch, Some(leaf)),
|
||||
[] => (&[] as &[Identifier], None),
|
||||
}
|
||||
}
|
||||
@@ -17,12 +17,10 @@ use ratatui::widgets::{Block, Scrollbar, ScrollbarState, StatefulWidget, Widget}
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
mod flatten;
|
||||
mod identifier;
|
||||
mod item;
|
||||
mod state;
|
||||
|
||||
pub use crate::flatten::Flattened;
|
||||
pub use crate::identifier::get_without_leaf as get_identifier_without_leaf;
|
||||
pub use crate::item::Item as TreeItem;
|
||||
pub use crate::state::State as TreeState;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user