Skip to content

Commit efd0ead

Browse files
committed
Implement get() for Fetch and Name
1 parent 54bca3e commit efd0ead

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/types/fetch.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ impl Fetches {
8181
pub fn is_empty(&self) -> bool {
8282
self.borrow_fetches().is_empty()
8383
}
84+
85+
/// Get the element at the given index
86+
pub fn get(&self, index: usize) -> Option<&Fetch<'_>> {
87+
self.borrow_fetches().get(index)
88+
}
8489
}
8590

8691
/// An IMAP [`FETCH` response](https://tools.ietf.org/html/rfc3501#section-7.4.2) that contains

src/types/name.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ impl Names {
5858
pub fn is_empty(&self) -> bool {
5959
self.borrow_names().is_empty()
6060
}
61+
62+
/// Get the element at the given index
63+
pub fn get(&self, index: usize) -> Option<&Name<'_>> {
64+
self.borrow_names().get(index)
65+
}
6166
}
6267

6368
/// A name that matches a `LIST` or `LSUB` command.

0 commit comments

Comments
 (0)