use arrow_array::RecordBatch;
#[derive(Debug, Clone)]
pub enum LookupResult {
Hit(RecordBatch),
Pending,
NotFound,
}
impl LookupResult {
#[must_use]
pub const fn is_hit(&self) -> bool {
matches!(self, Self::Hit(_))
}
#[must_use]
pub const fn is_not_found(&self) -> bool {
matches!(self, Self::NotFound)
}
#[must_use]
pub fn into_batch(self) -> Option<RecordBatch> {
match self {
Self::Hit(b) => Some(b),
_ => None,
}
}
}
impl PartialEq for LookupResult {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Hit(a), Self::Hit(b)) => a == b,
(Self::Pending, Self::Pending) | (Self::NotFound, Self::NotFound) => true,
_ => false,
}
}
}
impl Eq for LookupResult {}