pub struct DirectoryNavigationProvider {
root: PathBuf,
source_type: SourceType,
}Expand description
A navigation provider that traverses directory structures.
This provider can use either plain filesystem operations or library-aware filtering, depending on the use case:
- Filesystem mode: Shows all directories (for FileChooser)
- Library mode: Respects library settings like hidden file filtering (for Home view)
§Examples
Create a filesystem provider for browsing all directories:
use std::path::PathBuf;
use cadmus_core::view::navigation::providers::directory::DirectoryNavigationProvider;
let provider = DirectoryNavigationProvider::filesystem(PathBuf::from("/home/user"));Create a library provider for filtered navigation:
use std::path::PathBuf;
use cadmus_core::view::navigation::providers::directory::DirectoryNavigationProvider;
let provider = DirectoryNavigationProvider::library(PathBuf::from("/home/user/books"));Fields§
§root: PathBuf§source_type: SourceTypeImplementations§
Sourcepub fn filesystem(root: PathBuf) -> Self
pub fn filesystem(root: PathBuf) -> Self
Creates a provider for plain filesystem navigation.
This shows all directories without any filtering, suitable for file chooser dialogs that need to browse the entire filesystem.
§Examples
use std::path::PathBuf;
use cadmus_core::view::navigation::providers::directory::DirectoryNavigationProvider;
let provider = DirectoryNavigationProvider::filesystem(PathBuf::from("/home/user"));Sourcepub fn library(root: PathBuf) -> Self
pub fn library(root: PathBuf) -> Self
Creates a provider for library-aware navigation.
This respects library settings like hidden file filtering, suitable for the Home view navigation.
§Examples
use std::path::PathBuf;
use cadmus_core::view::navigation::providers::directory::DirectoryNavigationProvider;
let provider = DirectoryNavigationProvider::library(PathBuf::from("/home/user/books"));Sourcefn list_directories(&self, path: &Path, context: &Context) -> BTreeSet<PathBuf>
fn list_directories(&self, path: &Path, context: &Context) -> BTreeSet<PathBuf>
Lists directories using the configured source.
Sourcefn list_filesystem_dirs(&self, path: &Path) -> BTreeSet<PathBuf>
fn list_filesystem_dirs(&self, path: &Path) -> BTreeSet<PathBuf>
Lists directories from the filesystem without filtering.
Sourcefn list_library_dirs(&self, path: &Path, context: &Context) -> BTreeSet<PathBuf>
fn list_library_dirs(&self, path: &Path, context: &Context) -> BTreeSet<PathBuf>
Lists directories using the library’s filtering rules.
fn guess_bar_size(dirs: &BTreeSet<PathBuf>) -> usize
Trait Implementations§
Source§fn clone(&self) -> DirectoryNavigationProvider
fn clone(&self) -> DirectoryNavigationProvider
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§type Bar = DirectoriesBar
type Bar = DirectoriesBar
Source§fn selected_leaf_key(&self, selected: &Self::LevelKey) -> Self::LevelKey
fn selected_leaf_key(&self, selected: &Self::LevelKey) -> Self::LevelKey
Source§fn leaf_for_bar_traversal(
&self,
selected: &Self::LevelKey,
context: &Context,
) -> Self::LevelKey
fn leaf_for_bar_traversal( &self, selected: &Self::LevelKey, context: &Context, ) -> Self::LevelKey
Source§fn parent(&self, current: &Self::LevelKey) -> Option<Self::LevelKey>
fn parent(&self, current: &Self::LevelKey) -> Option<Self::LevelKey>
Source§fn is_ancestor(
&self,
ancestor: &Self::LevelKey,
descendant: &Self::LevelKey,
) -> bool
fn is_ancestor( &self, ancestor: &Self::LevelKey, descendant: &Self::LevelKey, ) -> bool
ancestor is an ancestor of descendant.Source§fn is_root(&self, key: &Self::LevelKey, _context: &Context) -> bool
fn is_root(&self, key: &Self::LevelKey, _context: &Context) -> bool
Source§fn fetch_level_data(
&self,
key: &Self::LevelKey,
context: &mut Context,
) -> Self::LevelData
fn fetch_level_data( &self, key: &Self::LevelKey, context: &mut Context, ) -> Self::LevelData
Source§fn estimate_line_count(
&self,
_key: &Self::LevelKey,
data: &Self::LevelData,
) -> usize
fn estimate_line_count( &self, _key: &Self::LevelKey, data: &Self::LevelData, ) -> usize
Source§fn create_bar(&self, rect: Rectangle, key: &Self::LevelKey) -> Self::Bar
fn create_bar(&self, rect: Rectangle, key: &Self::LevelKey) -> Self::Bar
Source§fn bar_key(&self, bar: &Self::Bar) -> Self::LevelKey
fn bar_key(&self, bar: &Self::Bar) -> Self::LevelKey
Source§fn update_bar(
&self,
bar: &mut Self::Bar,
data: &Self::LevelData,
selected: &Self::LevelKey,
fonts: &mut Fonts,
)
fn update_bar( &self, bar: &mut Self::Bar, data: &Self::LevelData, selected: &Self::LevelKey, fonts: &mut Fonts, )
Source§fn update_bar_selection(&self, bar: &mut Self::Bar, selected: &Self::LevelKey)
fn update_bar_selection(&self, bar: &mut Self::Bar, selected: &Self::LevelKey)
Auto Trait Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more