diff options
Diffstat (limited to 'src/db.rs')
-rw-r--r-- | src/db.rs | 38 |
1 files changed, 0 insertions, 38 deletions
@@ -54,7 +54,6 @@ const fn eq_case(lhs: &[u8], rhs: &[u8]) -> bool { } /// A query interface for OIDs/Names. -#[derive(Copy, Clone)] pub struct Database<'a>(&'a [(&'a ObjectIdentifier, &'a str)]); impl<'a> Database<'a> { @@ -100,43 +99,6 @@ impl<'a> Database<'a> { None } - - /// Return the list of matched name for the OID. - pub const fn find_names_for_oid(&self, oid: ObjectIdentifier) -> Names<'a> { - Names { - database: *self, - oid, - position: 0, - } - } -} - -/// Iterator returning the multiple names that may be associated with an OID. -pub struct Names<'a> { - database: Database<'a>, - oid: ObjectIdentifier, - position: usize, -} - -impl<'a> Iterator for Names<'a> { - type Item = &'a str; - - fn next(&mut self) -> Option<&'a str> { - let mut i = self.position; - - while i < self.database.0.len() { - let lhs = self.database.0[i].0; - - if lhs.as_bytes().eq(self.oid.as_bytes()) { - self.position = i + 1; - return Some(self.database.0[i].1); - } - - i += 1; - } - - None - } } #[cfg(test)] |