s2n_quic_core/buffer/duplex.rs
1// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4use super::{Error, Reader, Writer};
5use crate::varint::VarInt;
6
7mod interposer;
8
9pub use interposer::Interposer;
10
11/// A buffer that is capable of both reading and writing
12pub trait Duplex: Reader + Writer {}
13
14impl<T: Reader + Writer> Duplex for T {}
15
16/// A buffer which can be advanced forward without reading or writing payloads. This
17/// is essentially a forward-only [`std::io::Seek`].
18///
19/// This can be used for scenarios where the buffer was written somewhere else but still needed to
20/// be tracked.
21pub trait Skip: Duplex {
22 fn skip(&mut self, len: VarInt, final_offset: Option<VarInt>) -> Result<(), Error>;
23}