pub struct CzdbMemory { /* private fields */ }Expand description
In-memory CZDB searcher with a prebuilt index and string pool.
预构建索引与字符串池的内存 CZDB 查询器。
Implementations§
Source§impl CzdbMemory
impl CzdbMemory
Sourcepub fn open(db_path: &str, key: &str) -> Result<Self, CzError>
pub fn open(db_path: &str, key: &str) -> Result<Self, CzError>
Open a database file and build in-memory indices.
打开数据库文件并构建内存索引。
Sourcepub fn from_bytes(data: Vec<u8>, key: &str) -> Result<Self, CzError>
pub fn from_bytes(data: Vec<u8>, key: &str) -> Result<Self, CzError>
Build from raw bytes and construct in-memory indices.
从原始字节构建并生成内存索引。
Sourcepub fn search_ref(&self, ip: IpAddr) -> Option<&str>
pub fn search_ref(&self, ip: IpAddr) -> Option<&str>
Search a single IP address and return a borrowed string.
查询指定 IP 并返回借用字符串。
Sourcepub fn search_many(&self, ips: &[IpAddr]) -> Vec<Option<String>>
pub fn search_many(&self, ips: &[IpAddr]) -> Vec<Option<String>>
Search a small batch of IP addresses.
批量查询 IP(小批量)。
Sourcepub fn search_many_ref<'a>(&'a self, ips: &[IpAddr]) -> Vec<Option<&'a str>>
pub fn search_many_ref<'a>(&'a self, ips: &[IpAddr]) -> Vec<Option<&'a str>>
Search a batch of IP addresses and return borrowed strings.
批量查询 IP 并返回借用字符串。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CzdbMemory
impl RefUnwindSafe for CzdbMemory
impl Send for CzdbMemory
impl Sync for CzdbMemory
impl Unpin for CzdbMemory
impl UnwindSafe for CzdbMemory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more