pub use crate::error::ERR_WRONG_TYPE;
pub const ERR_NO_SUCH_KEY: &str = "ERR no such key";
pub const ERR_INDEX_OUT_OF_RANGE: &str = "ERR index out of range";
pub const ERR_RANK_ZERO: &str = "ERR RANK can't be zero: must be 1, 2, 3, ... or -1, -2, -3...";
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct PosSpec {
pub rank: i64,
pub count: Option<usize>,
pub max_len: Option<usize>,
}
impl PosSpec {
#[inline]
pub const fn new() -> Self {
Self {
rank: 1,
count: None,
max_len: None,
}
}
#[inline]
pub const fn with_rank(mut self, rank: i64) -> Self {
self.rank = rank;
self
}
#[inline]
pub const fn with_count(mut self, count: usize) -> Self {
self.count = Some(count);
self
}
#[inline]
pub const fn with_max_len(mut self, max_len: usize) -> Self {
self.max_len = Some(max_len);
self
}
}
impl Default for PosSpec {
#[inline]
fn default() -> Self {
Self::new()
}
}