pub struct DatasetRegistry { /* private fields */ }Expand description
Registry for dynamically registered custom datasets.
This allows users to register their own datasets at runtime without modifying the built-in enum.
Implementations§
Source§impl DatasetRegistry
impl DatasetRegistry
Sourcepub fn new() -> DatasetRegistry
pub fn new() -> DatasetRegistry
Create a new empty registry.
Sourcepub fn register(
&mut self,
dataset: impl DatasetSpec + 'static,
) -> Option<Box<dyn DatasetSpec>>
pub fn register( &mut self, dataset: impl DatasetSpec + 'static, ) -> Option<Box<dyn DatasetSpec>>
Register a custom dataset.
Returns the previous dataset with this ID if one existed.
Sourcepub fn get(&self, id: &str) -> Option<&dyn DatasetSpec>
pub fn get(&self, id: &str) -> Option<&dyn DatasetSpec>
Get a dataset by ID.
Sourcepub fn unregister(&mut self, id: &str) -> Option<Box<dyn DatasetSpec>>
pub fn unregister(&mut self, id: &str) -> Option<Box<dyn DatasetSpec>>
Remove a dataset by ID.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &dyn DatasetSpec)>
pub fn iter(&self) -> impl Iterator<Item = (&str, &dyn DatasetSpec)>
Iterate over all registered datasets.
Sourcepub fn by_task(&self, task: Task) -> impl Iterator<Item = &dyn DatasetSpec>
pub fn by_task(&self, task: Task) -> impl Iterator<Item = &dyn DatasetSpec>
Filter datasets by task.
Sourcepub fn by_language<'a>(
&'a self,
lang: &'a str,
) -> impl Iterator<Item = &'a dyn DatasetSpec>
pub fn by_language<'a>( &'a self, lang: &'a str, ) -> impl Iterator<Item = &'a dyn DatasetSpec>
Filter datasets by language.
Sourcepub fn by_domain(
&self,
domain: Domain,
) -> impl Iterator<Item = &dyn DatasetSpec>
pub fn by_domain( &self, domain: Domain, ) -> impl Iterator<Item = &dyn DatasetSpec>
Filter datasets by domain.
Sourcepub fn public_only(&self) -> impl Iterator<Item = &dyn DatasetSpec>
pub fn public_only(&self) -> impl Iterator<Item = &dyn DatasetSpec>
Filter datasets that are publicly available (no auth, redistributable license).
Sourcepub fn historical(&self) -> impl Iterator<Item = &dyn DatasetSpec>
pub fn historical(&self) -> impl Iterator<Item = &dyn DatasetSpec>
Filter historical/ancient language datasets.
Sourcepub fn with_entity_type<'a>(
&'a self,
entity_type: &'a str,
) -> impl Iterator<Item = &'a dyn DatasetSpec>
pub fn with_entity_type<'a>( &'a self, entity_type: &'a str, ) -> impl Iterator<Item = &'a dyn DatasetSpec>
Find datasets supporting a specific entity type.
Sourcepub fn summary(&self) -> RegistrySummary
pub fn summary(&self) -> RegistrySummary
Get summary statistics about registered datasets.
Trait Implementations§
Source§impl Debug for DatasetRegistry
impl Debug for DatasetRegistry
Source§impl Default for DatasetRegistry
impl Default for DatasetRegistry
Source§fn default() -> DatasetRegistry
fn default() -> DatasetRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DatasetRegistry
impl !RefUnwindSafe for DatasetRegistry
impl Send for DatasetRegistry
impl Sync for DatasetRegistry
impl Unpin for DatasetRegistry
impl UnsafeUnpin for DatasetRegistry
impl !UnwindSafe for DatasetRegistry
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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