Skip to content

Commit

Permalink
public iter_external_loaders
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Dec 14, 2023
1 parent 1853070 commit 4995c64
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
12 changes: 10 additions & 2 deletions crates/re_data_source/src/data_loader/loader_external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ pub static EXTERNAL_LOADER_PATHS: Lazy<Vec<std::path::PathBuf>> = Lazy::new(|| {
executables.into_iter().collect()
});

/// Iterator over all registered [`DataLoader`]s.
#[inline]
pub fn iter_external_loaders() -> impl ExactSizeIterator<Item = std::path::PathBuf> {
EXTERNAL_LOADER_PATHS.iter().cloned()
}

// ---

// TODO: this is the stdio integration
// TODO: binary plugin example and indicate how to not care about ext
pub struct ExternalDataLoader;
Expand All @@ -54,7 +62,7 @@ impl crate::DataLoader for ExternalDataLoader {
"rerun.data_loaders.External".into()
}

fn load_from_file(
fn load_from_path(
&self,
store_id: re_log_types::StoreId,
filepath: std::path::PathBuf,
Expand Down Expand Up @@ -127,7 +135,7 @@ impl crate::DataLoader for ExternalDataLoader {
}

#[inline]
fn load_from_file_contents(
fn load_from_path_contents(
&self,
_store_id: re_log_types::StoreId,
_path: std::path::PathBuf,
Expand Down
4 changes: 3 additions & 1 deletion crates/re_data_source/src/data_loader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,6 @@ pub use self::loader_rrd::RrdLoader;
#[cfg(not(target_arch = "wasm32"))]
pub(crate) use self::loader_external::EXTERNAL_LOADER_PATHS;
#[cfg(not(target_arch = "wasm32"))]
pub use self::loader_external::{ExternalDataLoader, EXTERNAL_DATA_LOADER_PREFIX};
pub use self::loader_external::{
iter_external_loaders, ExternalDataLoader, EXTERNAL_DATA_LOADER_PREFIX,
};
3 changes: 2 additions & 1 deletion crates/re_data_source/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ mod web_sockets;
mod load_stdin;

pub use self::data_loader::{
iter_loaders, ArchetypeLoader, DataLoader, DataLoaderError, LoadedData, RrdLoader,
iter_external_loaders, iter_loaders, ArchetypeLoader, DataLoader, DataLoaderError, LoadedData,
RrdLoader,
};
pub use self::data_source::DataSource;
pub use self::load_file::load_from_path_contents;
Expand Down

0 comments on commit 4995c64

Please sign in to comment.