surrealdb/api/opt/endpoint/
mem.rs

1use crate::api::engine::local::Db;
2use crate::api::engine::local::Mem;
3use crate::api::opt::Endpoint;
4use crate::api::opt::IntoEndpoint;
5use crate::api::Result;
6use crate::opt::Config;
7use url::Url;
8
9impl IntoEndpoint<Mem> for () {
10	type Client = Db;
11
12	fn into_endpoint(self) -> Result<Endpoint> {
13		Ok(Endpoint {
14			url: Url::parse("mem://").unwrap(),
15			path: "memory".to_owned(),
16			config: Default::default(),
17		})
18	}
19}
20
21impl IntoEndpoint<Mem> for Config {
22	type Client = Db;
23
24	fn into_endpoint(self) -> Result<Endpoint> {
25		let mut endpoint = IntoEndpoint::<Mem>::into_endpoint(())?;
26		endpoint.config = self;
27		Ok(endpoint)
28	}
29}