Skip to main content

SendBuffer

Struct SendBuffer 

Source
pub struct SendBuffer {
    pub max_message_size: usize,
    pub max_chunk_count: usize,
    pub send_buffer_size: usize,
    /* private fields */
}
Expand description

General implementation of a buffer of outgoing messages.

Fields§

§max_message_size: usize

Maximum size of a message, total. Use 0 for no limit

§max_chunk_count: usize

Maximum number of chunks in a message.

§send_buffer_size: usize

Maximum size of each individual chunk.

Implementations§

Source§

impl SendBuffer

Source

pub fn new( buffer_size: usize, max_message_size: usize, max_chunk_count: usize, sequence_numbers_legacy: bool, ) -> SendBuffer

Create a new send buffer with the given initial limits.

Source

pub fn encode_next_chunk( &mut self, secure_channel: &SecureChannel, ) -> Result<(), StatusCode>

Encode the next chunk in the queue to the out-buffer.

Source

pub fn set_sequence_number_legacy(&mut self, is_legacy: bool)

Set whether we are using legacy sequence numbers or not. This depends on the active security policy.

Source

pub fn write_error(&mut self, error: ErrorMessage)

Clear the list of pending messages, then add an error.

Source

pub fn write_ack(&mut self, ack: AcknowledgeMessage)

Write an acknowledge message to the list of pending messages.

Source

pub fn write( &mut self, request_id: u32, message: impl Message, secure_channel: &SecureChannel, ) -> Result<u32, Error>

Encode a message to chunks, then write them to the pending message queue.

The messages are encrypted as they are sent.

Source

pub fn next_request_id(&mut self) -> u32

Get the next request ID.

Source

pub async fn read_into_async( &mut self, write: &mut (impl AsyncWrite + Unpin), ) -> Result<(), Error>

Read the pending buffer into the given stream.

Source

pub fn should_encode_chunks(&self) -> bool

Return true if we should encode a new chunk.

Source

pub fn can_read(&self) -> bool

Check if we can read data from the buffer into the stream.

Source

pub fn revise( &mut self, send_buffer_size: usize, max_message_size: usize, max_chunk_count: usize, )

Revise the limits with the result of a hello/acknowledge message.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoAnyArc for T
where T: Send + Sync + 'static,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Upcast to Arc<dyn Any>.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more