pub mod v1 {
hrpc::include_proto!("protocol.harmonytypes.v1");
}
pub use v1::*;
impl ItemPosition {
pub fn new_after(item_id: u64) -> Self {
Self {
item_id,
position: item_position::Position::After.into(),
}
}
pub fn after(&self) -> Option<u64> {
matches!(self.position(), item_position::Position::After).then(|| self.item_id)
}
pub fn new_before(item_id: u64) -> Self {
Self {
item_id,
position: item_position::Position::BeforeUnspecified.into(),
}
}
pub fn before(&self) -> Option<u64> {
matches!(self.position(), item_position::Position::BeforeUnspecified).then(|| self.item_id)
}
}