-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(s2n-quic-core): add buffer reader/writer traits (#2097)
- Loading branch information
Showing
46 changed files
with
3,918 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pub mod duplex; | ||
mod error; | ||
pub mod reader; | ||
pub mod reassembler; | ||
pub mod writer; | ||
|
||
pub use duplex::Duplex; | ||
pub use error::Error; | ||
pub use reader::Reader; | ||
pub use reassembler::Reassembler; | ||
pub use writer::Writer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use super::{Error, Reader, Writer}; | ||
use crate::varint::VarInt; | ||
|
||
mod interposer; | ||
|
||
pub use interposer::Interposer; | ||
|
||
/// A buffer that is capable of both reading and writing | ||
pub trait Duplex: Reader + Writer {} | ||
|
||
impl<T: Reader + Writer> Duplex for T {} | ||
|
||
/// A buffer which can be advanced forward without reading or writing payloads. This | ||
/// is essentially a forward-only [`std::io::Seek`]. | ||
/// | ||
/// This can be used for scenarios where the buffer was written somewhere else but still needed to | ||
/// be tracked. | ||
pub trait Skip: Duplex { | ||
fn skip(&mut self, len: VarInt, final_offset: Option<VarInt>) -> Result<(), Error>; | ||
} |
Oops, something went wrong.