Skip to main content

CatalogProviderList

Trait CatalogProviderList 

Source
pub trait CatalogProviderList:
    Any
    + Debug
    + Sync
    + Send {
    // Required methods
    fn register_catalog(
        &self,
        name: String,
        catalog: Arc<dyn CatalogProvider>,
    ) -> Option<Arc<dyn CatalogProvider>>;
    fn catalog_names(&self) -> Vec<String>;
    fn catalog(&self, name: &str) -> Option<Arc<dyn CatalogProvider>>;

    // Provided method
    fn deregister_catalog(
        &self,
        name: &str,
        cascade: bool,
    ) -> Result<Option<Arc<dyn CatalogProvider>>> { ... }
}
Expand description

Represent a list of named CatalogProviders.

Please see the documentation on CatalogProvider for details of implementing a custom catalog.

Required Methods§

Source

fn register_catalog( &self, name: String, catalog: Arc<dyn CatalogProvider>, ) -> Option<Arc<dyn CatalogProvider>>

Adds a new catalog to this catalog list If a catalog of the same name existed before, it is replaced in the list and returned.

Source

fn catalog_names(&self) -> Vec<String>

Retrieves the list of available catalog names

Source

fn catalog(&self, name: &str) -> Option<Arc<dyn CatalogProvider>>

Retrieves a specific catalog by name, provided it exists.

Provided Methods§

Source

fn deregister_catalog( &self, name: &str, cascade: bool, ) -> Result<Option<Arc<dyn CatalogProvider>>>

Removes a catalog from this list, returning it if it existed.

Implementations of this method should return Ok(None) if no catalog with name exists.

If cascade is false, implementations should return an error if the catalog is not empty.

By default returns a “Not Implemented” error

Implementations§

Source§

impl dyn CatalogProviderList

Source

pub fn is<T: CatalogProviderList>(&self) -> bool

Returns true if the catalog provider list is of type T.

Prefer this over downcast_ref::<T>().is_some(). Works correctly when called on Arc<dyn CatalogProviderList> via auto-deref.

Source

pub fn downcast_ref<T: CatalogProviderList>(&self) -> Option<&T>

Attempts to downcast this catalog provider list to a concrete type T, returning None if the provider list is not of that type.

Works correctly when called on Arc<dyn CatalogProviderList> via auto-deref, unlike (&arc as &dyn Any).downcast_ref::<T>() which would attempt to downcast the Arc itself.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§