27 lines
775 B
Rust
27 lines
775 B
Rust
//! Meow protocol v2 wire types.
|
|||
|
|
//!
|
||
|
|
//! Generated from `rust/proto/meow.proto`. This crate contains no logic besides
|
||
|
|
//! small encoding helpers; protocol semantics live in `meow-core`.
|
||
|
|
|
||
|
|
#![forbid(unsafe_code)]
|
||
|
|
#![cfg_attr(not(test), warn(clippy::unwrap_used, clippy::expect_used))]
|
||
|
|
|
||
|
|
#[allow(clippy::all, missing_docs)]
|
||
|
|
pub mod v2 {
|
||
|
|
include!(concat!(env!("OUT_DIR"), "/meow.v2.rs"));
|
||
|
|
}
|
||
|
|
|
||
|
|
pub use prost::Message;
|
||
|
|
|
||
|
|
/// Current protocol version carried in every top-level wire object.
|
||
|
|
pub const PROTOCOL_VERSION: u32 = 2;
|
||
|
|
|
||
|
|
/// Decode helper returning a uniform error type.
|
||
|
|
pub fn decode<M: Message + Default>(bytes: &[u8]) -> Result<M, prost::DecodeError> {
|
||
|
|
M::decode(bytes)
|
||
|
|
}
|
||
|
|
|
||
|
|
/// Encode helper.
|
||
|
|
pub fn encode<M: Message>(msg: &M) -> Vec<u8> {
|
||
|
|
msg.encode_to_vec()
|
||
|
|
}
|