Skip to content

Commit

Permalink
more inline
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Apr 27, 2023
1 parent 13fe6b3 commit 2792cae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ctors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use std::mem::MaybeUninit;

impl<K: Clone + PartialEq, V: Clone, const N: usize> Default for Map<K, V, N> {
/// Make a default empty [`Map`].
#[inline]
#[must_use]
fn default() -> Self {
Self::new()
}
Expand Down
1 change: 1 addition & 0 deletions src/eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ impl<K: Clone + PartialEq, V: Clone + PartialEq, const N: usize> PartialEq for M
/// m2.insert(2, 1);
/// assert_eq!(m1, m2);
/// ```
#[inline]
fn eq(&self, other: &Self) -> bool {
return self.len() == other.len() && self.iter().all(|(k, v)| other.get(k) == Some(v));
}
Expand Down
2 changes: 2 additions & 0 deletions src/from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use crate::Map;

impl<K: Clone + PartialEq, V: Clone, const N: usize> FromIterator<(K, V)> for Map<K, V, N> {
#[inline]
#[must_use]
fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> Self {
let mut m: Self = Self::new();
for (k, v) in iter {
Expand All @@ -33,6 +34,7 @@ impl<K: Clone + PartialEq, V: Clone, const N: usize> FromIterator<(K, V)> for Ma

impl<K: Clone + PartialEq, V: Clone, const N: usize> From<[(K, V); N]> for Map<K, V, N> {
#[inline]
#[must_use]
fn from(arr: [(K, V); N]) -> Self {
Self::from_iter(arr)
}
Expand Down

0 comments on commit 2792cae

Please sign in to comment.