memento/
lib.rs

1extern crate core;
2
3mod command;
4mod connection;
5mod error;
6mod memento;
7
8pub use self::{command::*, error::*, memento::*};
9use std::fmt::Debug;
10
11use tokio::net::ToSocketAddrs;
12
13pub type Result<T> = std::result::Result<T, MementoError>;
14
15pub trait ToCommandResponse: Default {
16    fn create<T>(frames: Vec<T>, cmd: Command) -> Result<Option<Self>>
17    where
18        T: ToString + Debug + Default;
19}
20
21///
22/// ```rust
23/// use memento::Result;
24///
25/// #[tokio::main]
26/// async fn main() -> Result<()> {
27///     let client = memento::new("localhost:11211").await?;
28///
29///     Ok(())
30/// }
31///```
32pub async fn new<A: ToSocketAddrs>(addr: A) -> Result<Memento> {
33    Memento::connect(addr).await
34}