pub struct TlsPlaintext<'input> { /* private fields */ }Expand description
One borrowed unprotected TLS record.
The fragment aliases the caller’s input and is not copied or allocated.
ⓘ
let bytes = [22, 3, 3, 0, 1, 0];
let policy = brynja_protocol::WirePolicy::for_version(
brynja_core::ProtocolVersion::Tls13,
);
let (record, _) = brynja_protocol::TlsPlaintext::parse(policy, &bytes).unwrap();
println!("{record:?}");Implementations§
Source§impl<'input> TlsPlaintext<'input>
impl<'input> TlsPlaintext<'input>
Sourcepub fn parse(
policy: WirePolicy,
input: &'input [u8],
) -> Result<(Self, &'input [u8]), RecordError>
pub fn parse( policy: WirePolicy, input: &'input [u8], ) -> Result<(Self, &'input [u8]), RecordError>
Parses one TLS plaintext record under an already selected policy.
Success returns the exact unconsumed stream suffix. Failure has no caller-visible cursor mutation.
Sourcepub fn new(
policy: WirePolicy,
content_type: ContentTypeCode,
legacy_record_version: LegacyRecordVersion,
fragment: &'input [u8],
) -> Result<Self, RecordError>
pub fn new( policy: WirePolicy, content_type: ContentTypeCode, legacy_record_version: LegacyRecordVersion, fragment: &'input [u8], ) -> Result<Self, RecordError>
Constructs a checked plaintext envelope for encoding.
Sourcepub const fn content_type(&self) -> ContentType
pub const fn content_type(&self) -> ContentType
Returns the admitted content type.
Sourcepub const fn legacy_record_version(&self) -> LegacyRecordVersion
pub const fn legacy_record_version(&self) -> LegacyRecordVersion
Returns the preserved, non-negotiating legacy bytes.
Sourcepub const fn encoded_len(&self) -> usize
pub const fn encoded_len(&self) -> usize
Returns the complete encoded length.
Trait Implementations§
Source§impl<'input> Clone for TlsPlaintext<'input>
impl<'input> Clone for TlsPlaintext<'input>
Source§fn clone(&self) -> TlsPlaintext<'input>
fn clone(&self) -> TlsPlaintext<'input>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'input> Copy for TlsPlaintext<'input>
impl<'input> Eq for TlsPlaintext<'input>
Source§impl<'input> PartialEq for TlsPlaintext<'input>
impl<'input> PartialEq for TlsPlaintext<'input>
impl<'input> StructuralPartialEq for TlsPlaintext<'input>
Auto Trait Implementations§
impl<'input> Freeze for TlsPlaintext<'input>
impl<'input> RefUnwindSafe for TlsPlaintext<'input>
impl<'input> Send for TlsPlaintext<'input>
impl<'input> Sync for TlsPlaintext<'input>
impl<'input> Unpin for TlsPlaintext<'input>
impl<'input> UnsafeUnpin for TlsPlaintext<'input>
impl<'input> UnwindSafe for TlsPlaintext<'input>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more