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:
EdJoPaTo
2024-02-26 20:49:21 +01:00
parent ed9a54a55a
commit a2f8100fe7
2 changed files with 0 additions and 29 deletions
-27
View File
@@ -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),
}
}
-2
View File
@@ -17,12 +17,10 @@ use ratatui::widgets::{Block, Scrollbar, ScrollbarState, StatefulWidget, Widget}
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
mod flatten; mod flatten;
mod identifier;
mod item; mod item;
mod state; mod state;
pub use crate::flatten::Flattened; 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::item::Item as TreeItem;
pub use crate::state::State as TreeState; pub use crate::state::State as TreeState;