2024-01-30 05:36:27 +08:00
|
|
|
use crate::collab_builder::{CollabPluginProviderContext, CollabPluginProviderType};
|
|
|
|
use collab::preclude::CollabPlugin;
|
|
|
|
use lib_infra::future::Fut;
|
|
|
|
use std::rc::Rc;
|
2024-03-22 14:15:38 +07:00
|
|
|
use std::sync::Arc;
|
2024-01-30 05:36:27 +08:00
|
|
|
|
|
|
|
pub trait CollabCloudPluginProvider: 'static {
|
|
|
|
fn provider_type(&self) -> CollabPluginProviderType;
|
|
|
|
|
2024-02-25 07:49:44 +08:00
|
|
|
fn get_plugins(&self, context: CollabPluginProviderContext) -> Fut<Vec<Box<dyn CollabPlugin>>>;
|
2024-01-30 05:36:27 +08:00
|
|
|
|
|
|
|
fn is_sync_enabled(&self) -> bool;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<T> CollabCloudPluginProvider for Rc<T>
|
|
|
|
where
|
|
|
|
T: CollabCloudPluginProvider,
|
|
|
|
{
|
|
|
|
fn provider_type(&self) -> CollabPluginProviderType {
|
|
|
|
(**self).provider_type()
|
|
|
|
}
|
|
|
|
|
2024-02-25 07:49:44 +08:00
|
|
|
fn get_plugins(&self, context: CollabPluginProviderContext) -> Fut<Vec<Box<dyn CollabPlugin>>> {
|
2024-01-30 05:36:27 +08:00
|
|
|
(**self).get_plugins(context)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn is_sync_enabled(&self) -> bool {
|
|
|
|
(**self).is_sync_enabled()
|
|
|
|
}
|
|
|
|
}
|