use smallvec::SmallVec;
use crate::core::common::with_id::WithTypedId;
pub(super) const FIELD_SEP: char = '\u{001F}';
pub struct SearchableExtractor<'a> {
pub(super) text: &'a mut String,
pub(super) offsets: &'a mut SmallVec<[u32; 4]>,
}
impl<'a> SearchableExtractor<'a> {
pub fn push_field(&mut self, value: &str) {
self.offsets.push(self.text.len() as u32);
self.text.push_str(value);
self.text.push(FIELD_SEP);
}
}
pub trait Searchable: WithTypedId + Send + Sync + 'static {
fn extract_searchable(&self, extractor: &mut SearchableExtractor<'_>);
fn searchable_field_names() -> &'static [&'static str];
}