#[cfg(not(target_endian = "little"))]
compile_error!("GnitzDB requires a little-endian target; the wire format is LE-only.");
#[macro_export]
macro_rules! for_each_fixed_int {
($fi:expr, |$c:ident| $body:block) => {
match $fi {
$crate::FixedInt::U8 => {
const $c: $crate::FixedInt = $crate::FixedInt::U8;
$body
}
$crate::FixedInt::I8 => {
const $c: $crate::FixedInt = $crate::FixedInt::I8;
$body
}
$crate::FixedInt::U16 => {
const $c: $crate::FixedInt = $crate::FixedInt::U16;
$body
}
$crate::FixedInt::I16 => {
const $c: $crate::FixedInt = $crate::FixedInt::I16;
$body
}
$crate::FixedInt::U32 => {
const $c: $crate::FixedInt = $crate::FixedInt::U32;
$body
}
$crate::FixedInt::I32 => {
const $c: $crate::FixedInt = $crate::FixedInt::I32;
$body
}
$crate::FixedInt::U64 => {
const $c: $crate::FixedInt = $crate::FixedInt::U64;
$body
}
$crate::FixedInt::I64 => {
const $c: $crate::FixedInt = $crate::FixedInt::I64;
$body
}
}
};
}
#[macro_export]
macro_rules! wire_enum {
(
$(#[$meta:meta])*
$vis:vis enum $name:ident: $repr:ident {
$($(#[$vmeta:meta])* $variant:ident = $value:expr),+ $(,)?
}
) => {
$(#[$meta])*
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr($repr)]
$vis enum $name {
$($(#[$vmeta])* $variant = $value),+
}
impl $name {
pub const ALL: &'static [$name] = &[$($name::$variant),+];
#[inline]
pub const fn as_wire(self) -> $repr {
self as $repr
}
#[inline]
pub const fn from_wire(v: $repr) -> Option<Self> {
let mut i = 0;
while i < Self::ALL.len() {
if Self::ALL[i] as $repr == v {
return Some(Self::ALL[i]);
}
i += 1;
}
None
}
}
impl $crate::Wire for $name {
fn write(&self, w: &mut $crate::Writer) {
w.$repr(self.as_wire());
}
fn read(r: &mut $crate::Reader) -> Result<Self, String> {
let v = r.$repr()?;
Self::from_wire(v).ok_or_else(|| format!(concat!("unknown ", stringify!($name), " {}"), v))
}
}
};
}
mod bytes;
mod catalog;
mod circuit;
mod codec;
mod column;
mod deframe;
mod flags;
mod german_string;
mod handshake;
mod pk;
mod range;
mod read_spec;
mod region;
mod rel_descriptor;
mod types;
mod uuid;
mod xxh;
pub mod control;
pub mod decimal;
pub mod schema_block;
pub mod sys_rows;
pub mod txn_frame;
pub mod wal;
pub use bytes::*;
pub use catalog::*;
pub use circuit::*;
pub use codec::*;
pub use column::*;
pub use deframe::*;
pub use flags::*;
pub use german_string::*;
pub use handshake::*;
pub use pk::*;
pub use range::*;
pub use read_spec::*;
pub use region::*;
pub use rel_descriptor::*;
pub use types::*;
pub use uuid::*;
pub use xxh::*;