Skip to main content

MessageEncoder

Struct MessageEncoder 

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

Writes one GIOP message.

A constructor writes the message header and the message-specific header; body gives an encoder for the body, aligned as the version requires; finish fills in the message size.

Implementations§

Source§

impl MessageEncoder

Source

pub fn new( version: Version, order: ByteOrder, msg_type: MsgType, more_fragments: bool, ) -> Result<MessageEncoder>

Starts a message of any type with an empty body.

Source

pub fn request( version: Version, order: ByteOrder, header: &RequestHeader, ) -> Result<MessageEncoder>

Starts a Request.

Source

pub fn reply( version: Version, order: ByteOrder, header: &ReplyHeader, ) -> Result<MessageEncoder>

Starts a Reply.

Source

pub fn cancel_request( version: Version, order: ByteOrder, header: &CancelRequestHeader, ) -> Result<Vec<u8>>

Writes a CancelRequest.

Source

pub fn locate_request( version: Version, order: ByteOrder, header: &LocateRequestHeader, ) -> Result<Vec<u8>>

Writes a LocateRequest.

Source

pub fn locate_reply( version: Version, order: ByteOrder, header: &LocateReplyHeader, ) -> Result<MessageEncoder>

Starts a LocateReply.

Source

pub fn close_connection(version: Version, order: ByteOrder) -> Result<Vec<u8>>

Writes a CloseConnection.

Source

pub fn message_error(version: Version, order: ByteOrder) -> Result<Vec<u8>>

Writes a MessageError.

Source

pub fn fragment( version: Version, order: ByteOrder, request_id: u32, more_fragments: bool, ) -> Result<MessageEncoder>

Starts a Fragment. request_id is required for GIOP 1.2 and ignored for GIOP 1.1. The caller writes the continuation bytes with body.

Source

pub fn body(&mut self) -> &mut Encoder

The encoder for the message body. In GIOP 1.2 the first call pads to an 8-byte boundary for Request, Reply and LocateReply bodies.

Source

pub fn version(&self) -> Version

The version of the message.

Source

pub fn finish(self) -> Result<Vec<u8>>

Fills in the message size and returns the message bytes. Body padding is dropped again if no body was written.

Source

pub fn finish_shared(self) -> Result<OutMessage>

Like finish, but large octet sequences written with write_octet_seq_shared stay where they are, for a vectored write.

Trait Implementations§

Source§

impl Debug for MessageEncoder

Source§

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

Formats the value using the given formatter. Read more

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, 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, 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.