pub struct InMemoryAddressBookStore { /* private fields */ }Expand description
In-memory AddressBookStore backed by Vecs under an RwLock. Build
via Self::new + chainable with_* setters.
Implementations§
Source§impl InMemoryAddressBookStore
impl InMemoryAddressBookStore
Sourcepub fn with_book(self, owner: &str, book: AddressBook) -> Self
pub fn with_book(self, owner: &str, book: AddressBook) -> Self
Append an address book owned by owner. Use make_book for a sane default shape.
Sourcepub fn with_contact(self, book_id: i64, contact: Contact) -> Self
pub fn with_contact(self, book_id: i64, contact: Contact) -> Self
Append a contact to the given book id.
Sourcepub fn list_books_fails(self, msg: &str) -> Self
pub fn list_books_fails(self, msg: &str) -> Self
Make AddressBookStore::list_address_books return an error carrying msg.
Sourcepub fn get_book_fails(self, msg: &str) -> Self
pub fn get_book_fails(self, msg: &str) -> Self
Make AddressBookStore::get_address_book return an error carrying msg.
Sourcepub fn list_contacts_fails(self, msg: &str) -> Self
pub fn list_contacts_fails(self, msg: &str) -> Self
Make AddressBookStore::list_contacts return an error carrying msg.
Sourcepub fn get_contact_fails(self, msg: &str) -> Self
pub fn get_contact_fails(self, msg: &str) -> Self
Make AddressBookStore::get_contact return an error carrying msg.
Sourcepub fn contact_etag_fails(self, msg: &str) -> Self
pub fn contact_etag_fails(self, msg: &str) -> Self
Make AddressBookStore::contact_etag return an error carrying msg.
Sourcepub fn put_contact_fails(self, msg: &str) -> Self
pub fn put_contact_fails(self, msg: &str) -> Self
Make AddressBookStore::put_contact return an error carrying msg.
Sourcepub fn delete_contact_fails(self, msg: &str) -> Self
pub fn delete_contact_fails(self, msg: &str) -> Self
Make AddressBookStore::delete_contact return an error carrying msg.
Sourcepub fn ensure_default_fails(self, msg: &str) -> Self
pub fn ensure_default_fails(self, msg: &str) -> Self
Make the ensure_default_* trait method return an error carrying msg.
Sourcepub fn contacts_in(&self, book_id: i64) -> Vec<Contact>
pub fn contacts_in(&self, book_id: i64) -> Vec<Contact>
Read back every contact currently stored for book_id.
Trait Implementations§
Source§impl AddressBookStore for InMemoryAddressBookStore
impl AddressBookStore for InMemoryAddressBookStore
Source§fn list_address_books<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<AddressBook>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_address_books<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<AddressBook>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
user.Source§fn get_address_book<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user: &'life1 str,
book_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AddressBook>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_address_book<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user: &'life1 str,
book_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AddressBook>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
user + URL-decoded book_name.Source§fn list_contacts<'life0, 'async_trait>(
&'life0 self,
book_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Contact>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_contacts<'life0, 'async_trait>(
&'life0 self,
book_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Contact>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
book_id.Source§fn get_contact<'life0, 'life1, 'async_trait>(
&'life0 self,
book_id: i64,
uid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Contact>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_contact<'life0, 'life1, 'async_trait>(
&'life0 self,
book_id: i64,
uid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Contact>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
(book_id, uid).Source§fn contact_etag<'life0, 'life1, 'async_trait>(
&'life0 self,
book_id: i64,
uid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn contact_etag<'life0, 'life1, 'async_trait>(
&'life0 self,
book_id: i64,
uid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
(book_id, uid). Used for precondition checks.Source§fn put_contact<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
book_id: i64,
uid: &'life1 str,
vcard: &'life2 str,
etag: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<PutResult, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn put_contact<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
book_id: i64,
uid: &'life1 str,
vcard: &'life2 str,
etag: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<PutResult, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Source§fn delete_contact<'life0, 'life1, 'async_trait>(
&'life0 self,
book_id: i64,
uid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_contact<'life0, 'life1, 'async_trait>(
&'life0 self,
book_id: i64,
uid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
true on delete, false on not-found.Source§fn ensure_default_address_book<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ensure_default_address_book<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
user if they have none.