crabka-protocol 0.1.2

Apache Kafka wire-protocol codec (4.3.0), with typed RecordBatch and zero-copy borrowed decode
Documentation
// AUTO-GENERATED by crabka-protocol-codegen against a9ce3221537b8653448750697915607dc7936cf3. Do not edit.
// Clippy lints that fire on generated code patterns are suppressed here so
// that regenerating the file does not require manual allow annotations.
#![allow(
    clippy::absurd_extreme_comparisons,
    clippy::double_comparisons,
    clippy::elidable_lifetime_names,
    clippy::manual_string_new,
    clippy::must_use_candidate,
    clippy::unnecessary_wraps,
    clippy::cast_sign_loss,
    clippy::cast_possible_truncation,
    clippy::cast_possible_wrap,
    clippy::default_trait_access,
    clippy::derivable_impls,
    clippy::collapsible_if,
    clippy::new_without_default,
    clippy::unreadable_literal,
    clippy::redundant_closure_for_method_calls,
    clippy::nonminimal_bool,
    clippy::bool_comparison,
    clippy::map_unwrap_or,
    clippy::option_as_ref_deref,
    clippy::manual_range_contains,
    clippy::borrow_deref_ref,
    clippy::explicit_auto_deref,
    clippy::unnecessary_semicolon,
    unused_imports,
    unused_variables
)]

include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/generated/EndTxnMarker.borrowed.rs"
));

#[cfg(test)]
mod tests {
    use super::*;
    use crate::{DecodeBorrow, Encode};
    use bytes::BytesMut;

    #[test]
    fn min_version_roundtrips() {
        let v = MIN_VERSION;
        let msg = EndTxnMarker::default();
        let mut buf = BytesMut::new();
        msg.encode(&mut buf, v).unwrap();
        assert_eq!(msg.encoded_len(v), buf.len());
        let frozen = buf.freeze();
        let mut cur: &[u8] = &frozen;
        let _decoded = EndTxnMarker::decode_borrow(&mut cur, v).unwrap();
    }

    #[test]
    fn max_version_roundtrips() {
        let v = MAX_VERSION;
        let msg = EndTxnMarker::default();
        let mut buf = BytesMut::new();
        msg.encode(&mut buf, v).unwrap();
        assert_eq!(msg.encoded_len(v), buf.len());
        let frozen = buf.freeze();
        let mut cur: &[u8] = &frozen;
        let _decoded = EndTxnMarker::decode_borrow(&mut cur, v).unwrap();
    }
}