pub struct DriverFactory;Expand description
Driver factory using factory pattern 使用工厂模式的Driver工厂
Provides a unified interface for creating different driver implementations. 提供用于创建不同driver实现的统一接口。
Implementations§
Source§impl DriverFactory
impl DriverFactory
Sourcepub fn create(driver_type: DriverType) -> Result<Arc<dyn Driver>>
pub fn create(driver_type: DriverType) -> Result<Arc<dyn Driver>>
Create a driver with the specified type and default configuration 使用指定类型和默认配置创建driver
§Errors / 错误
Returns an error if: 返回错误如果:
- The specified driver type is not available on this platform
- 指定的driver类型在此平台上不可用
- Driver initialization fails
- Driver初始化失败
§Examples / 示例
ⓘ
use hiver_runtime::driver::{DriverFactory, DriverType};
let driver = DriverFactory::create(DriverType::Auto).unwrap();Sourcepub fn create_with_config(
driver_type: DriverType,
config: DriverConfig,
) -> Result<Arc<dyn Driver>>
pub fn create_with_config( driver_type: DriverType, config: DriverConfig, ) -> Result<Arc<dyn Driver>>
Create a driver with the specified type and configuration 使用指定类型和配置创建driver
§Errors / 错误
Returns an error if driver initialization fails. 如果driver初始化失败则返回错误。
Auto Trait Implementations§
impl Freeze for DriverFactory
impl RefUnwindSafe for DriverFactory
impl Send for DriverFactory
impl Sync for DriverFactory
impl Unpin for DriverFactory
impl UnsafeUnpin for DriverFactory
impl UnwindSafe for DriverFactory
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