Skip to main content

OutMessage

Struct OutMessage 

Source
pub struct OutMessage { /* private fields */ }
Expand description

A whole message to send: its bytes, with large octet sequences that were not copied in kept apart.

Implementations§

Source§

impl OutMessage

Source

pub fn len(&self) -> usize

The length of the message.

Source

pub fn is_empty(&self) -> bool

Whether the message has no bytes.

Source

pub fn as_single(&self) -> Option<&[u8]>

The whole message, if it is one piece.

Source

pub fn slices_from(&self, from: usize, max: usize) -> Vec<IoSlice<'_>>

The pieces of the message from offset from on, in order, for a vectored write; at most max of them.

Source

pub fn pieces(&self) -> impl Iterator<Item = &[u8]>

The pieces of the message in order.

Source

pub fn fragment(self, size: usize) -> OutMessage

Splits a GIOP 1.2 Request, Reply or LocateReply longer than size bytes into a first message and Fragment messages of at most size bytes each (size rounded down to a multiple of 8, at least 64), returned one after the other in one OutMessage. Other messages, and messages that fit, are returned as they are.

The first message keeps the whole message-specific header. Every message but the last is a multiple of 8 bytes long, so the body keeps its alignment whether it is read relative to the start of the whole message or of each Fragment (16 bytes of headers).

Source

pub fn with_reply_header( self, header: &ReplyHeader, ) -> Result<OutMessage, OutMessage>

The same Reply (made with MessageEncoder::reply) with the message-specific header header instead, for service contexts that are known only once the body has been written. The body is kept as it is: in GIOP 1.2 it starts on an 8-byte boundary after the header, so it does not depend on the header’s length. Before GIOP 1.2 it follows the header directly and is aligned from the start of the message, so a header whose length differs by 4 modulo 8 moves it off its alignment. Then the padding before each 8-byte aligned item of the body is written again (data aligned to at most 4 bytes is unaffected), unless the body holds something else whose bytes depend on stream offsets (a valuetype, a TypeCode indirection): then Err returns the message unchanged.

Source

pub fn into_vec(self) -> Vec<u8> ⓘ

The message as one buffer; copies only if octets were kept apart.

Trait Implementations§

Source§

impl Clone for OutMessage

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OutMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OutMessage

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for OutMessage

Source§

impl From<Vec<u8>> for OutMessage

Source§

fn from(bytes: Vec<u8>) -> OutMessage

Converts to this type from the input type.
Source§

impl PartialEq for OutMessage

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for OutMessage

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.