1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
use crate::api::engine::local::Db; use crate::api::engine::local::Mem; use crate::api::opt::Endpoint; use crate::api::opt::IntoEndpoint; use crate::api::Result; use crate::opt::Config; use url::Url; impl IntoEndpoint<Mem> for () { type Client = Db; fn into_endpoint(self) -> Result<Endpoint> { let protocol = "mem://"; let url = Url::parse(protocol) .unwrap_or_else(|_| unreachable!("`{protocol}` should be static and valid")); let mut endpoint = Endpoint::new(url); "memory".clone_into(&mut endpoint.path); Ok(endpoint) } } impl IntoEndpoint<Mem> for Config { type Client = Db; fn into_endpoint(self) -> Result<Endpoint> { #[expect(deprecated)] let mut endpoint = IntoEndpoint::<Mem>::into_endpoint(())?; endpoint.config = self; Ok(endpoint) } }