use super::Count;
pub trait MetaMember: 'static {
const USE_OFFSET: bool;
fn name(&self) -> &str;
fn count(&self) -> i32;
fn offset(&self) -> i32;
}
impl MetaMember for &'static str {
const USE_OFFSET: bool = false;
#[inline(always)]
fn name(&self) -> &str {
self
}
#[inline(always)]
fn count(&self) -> i32 {
0
}
#[inline(always)]
fn offset(&self) -> i32 {
0
}
}
impl MetaMember for (&'static str,) {
const USE_OFFSET: bool = false;
#[inline(always)]
fn name(&self) -> &str {
self.0
}
#[inline(always)]
fn count(&self) -> i32 {
0
}
#[inline(always)]
fn offset(&self) -> i32 {
0
}
}
impl MetaMember for (&'static str, Count) {
const USE_OFFSET: bool = false;
#[inline(always)]
fn name(&self) -> &str {
self.0
}
#[inline(always)]
fn count(&self) -> i32 {
self.1.0
}
#[inline(always)]
fn offset(&self) -> i32 {
0
}
}
impl MetaMember for (&'static str, Count, usize) {
const USE_OFFSET: bool = true;
#[inline(always)]
fn name(&self) -> &str {
self.0
}
#[inline(always)]
fn count(&self) -> i32 {
self.1.0
}
#[inline(always)]
fn offset(&self) -> i32 {
self.2 as i32
}
}