/* This file is part of jellything (https://codeberg.org/metamuffin/jellything) which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2026 metamuffin */ use anyhow::Result; use std::borrow::Cow; pub struct PrefixIterator<'a> { pub inner: Box>> + 'a>, pub prefix: Cow<'a, [u8]>, } impl Iterator for PrefixIterator<'_> { type Item = Result>; fn next(&mut self) -> Option { self.inner.next().filter(|k| match k { Ok(v) => v.starts_with(&self.prefix), Err(_) => true, }) } }