Struct melib::addressbook::AddressBook
source · pub struct AddressBook {
pub cards: IndexMap<CardId, Card>,
/* private fields */
}
Fields§
§cards: IndexMap<CardId, Card>
Implementations§
source§impl AddressBook
impl AddressBook
pub fn new(display_name: String) -> Self
pub fn with_account(s: &AccountSettings) -> Self
pub fn add_card(&mut self, card: Card)
pub fn remove_card(&mut self, card_id: CardId)
pub fn card_exists(&self, card_id: CardId) -> bool
pub fn search(&self, term: &str) -> Vec<String>
Methods from Deref<Target = IndexMap<CardId, Card>>§
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Return the number of key-value pairs in the map.
Computes in O(1) time.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the map contains no elements.
Computes in O(1) time.
sourcepub fn iter(&self) -> Iter<'_, K, V>
pub fn iter(&self) -> Iter<'_, K, V>
Return an iterator over the key-value pairs of the map, in their order
sourcepub fn keys(&self) -> Keys<'_, K, V>
pub fn keys(&self) -> Keys<'_, K, V>
Return an iterator over the keys of the map, in their order
sourcepub fn values(&self) -> Values<'_, K, V>
pub fn values(&self) -> Values<'_, K, V>
Return an iterator over the values of the map, in their order
sourcepub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
Return true
if an equivalent to key
exists in the map.
Computes in O(1) time (average).
sourcepub fn get<Q>(&self, key: &Q) -> Option<&V>
pub fn get<Q>(&self, key: &Q) -> Option<&V>
Return a reference to the value stored for key
, if it is present,
else None
.
Computes in O(1) time (average).
sourcepub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>
pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>
Return references to the key-value pair stored for key
,
if it is present, else None
.
Computes in O(1) time (average).
sourcepub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>
pub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>
Return item index, if it exists in the map
Computes in O(1) time (average).
Trait Implementations§
source§impl Clone for AddressBook
impl Clone for AddressBook
source§fn clone(&self) -> AddressBook
fn clone(&self) -> AddressBook
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for AddressBook
impl Debug for AddressBook
source§impl Deref for AddressBook
impl Deref for AddressBook
source§impl<'de> Deserialize<'de> for AddressBook
impl<'de> Deserialize<'de> for AddressBook
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for AddressBook
impl PartialEq for AddressBook
source§fn eq(&self, other: &AddressBook) -> bool
fn eq(&self, other: &AddressBook) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for AddressBook
impl Serialize for AddressBook
impl Eq for AddressBook
impl StructuralPartialEq for AddressBook
Auto Trait Implementations§
impl Freeze for AddressBook
impl RefUnwindSafe for AddressBook
impl Send for AddressBook
impl Sync for AddressBook
impl Unpin for AddressBook
impl UnwindSafe for AddressBook
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.