1mod capnp;
5mod jeff;
6
7#[cfg(test)]
8mod test;
9
10pub mod reader;
11pub mod types;
12pub use jeff::Jeff;
13
14#[doc(hidden)]
19pub use capnp::jeff_capnp;
20
21use derive_more::derive::{Display, Error, From};
22
23pub const SCHEMA_VERSION: u32 = 0;
25
26#[derive(Debug, Display, From, Error)]
28#[non_exhaustive]
29pub enum JeffError {
30 #[display("Invalid jeff file: {_0}")]
32 InvalidFile(::capnp::Error),
33 #[display("Invalid schema version: {v}. Expected {}", Jeff::VERSION)]
35 InvalidVersion {
36 v: u32,
38 },
39 ReadError(reader::ReadError),
41}
42
43#[derive(Clone, Copy, Debug, Display, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
45pub enum Direction {
46 #[default]
48 Incoming = 0,
49 Outgoing = 1,
51}
52
53impl Direction {
54 pub const BOTH: [Direction; 2] = [Direction::Incoming, Direction::Outgoing];
56
57 #[inline(always)]
59 pub fn reverse(self) -> Direction {
60 match self {
61 Direction::Incoming => Direction::Outgoing,
62 Direction::Outgoing => Direction::Incoming,
63 }
64 }
65}