[][src]Struct onc_rpc::RpcMessage

pub struct RpcMessage<T, P> where
    T: AsRef<[u8]>,
    P: AsRef<[u8]>, 
{ /* fields omitted */ }

An Open Network Computing RPC message, generic over a source of bytes (T) and a payload buffer (P`).

Implementations

impl<'a> RpcMessage<&'a [u8], &'a [u8]>[src]

pub fn from_bytes(
    buf: &'a [u8]
) -> Result<RpcMessage<&'a [u8], &'a [u8]>, Error>
[src]

Deserialises a new RpcMessage from buf.

Buf must contain exactly 1 message - if buf contains an incomplete message, or buf contains trailing bytes after the message IncompleteMessage is returned.

impl<T, P> RpcMessage<T, P> where
    T: AsRef<[u8]>,
    P: AsRef<[u8]>, 
[src]

pub fn new(xid: u32, message_type: MessageType<T, P>) -> Self[src]

Construct a new RpcMessage with the specified transaction ID and message body.

pub fn serialise_into(&self, buf: &mut Cursor<Vec<u8>>) -> Result<(), Error>[src]

Write this RpcMessage into buf, advancing the cursor to the end of the serialised message. buf must have capacity for at least serialised_len bytes from the current cursor position.

This method allows the caller to specify the underlying buffer used to hold the serialised message to enable reuse and pooling.

pub fn serialise(&self) -> Result<Vec<u8>, Error>[src]

Serialise this RpcMessage into a new Vec.

The returned vec will be sized exactly to contain this message. Calling this method is the equivalent of:

let mut buf = Vec::with_capacity(msg.serialised_len() as usize);
let mut c = Cursor::new(buf);
msg.serialise_into(&mut c);

pub fn serialised_len(&self) -> u32[src]

Returns the on-wire length of this message once serialised, including the message header.

pub fn xid(&self) -> u32[src]

The transaction ID for this request.

pub fn message(&self) -> &MessageType<T, P>[src]

The MessageType contained in this request.

pub fn call_body(&self) -> Option<&CallBody<T, P>>[src]

Returns the CallBody in this request, or None if this message is not a RPC call request.

pub fn reply_body(&self) -> Option<&ReplyBody<T, P>>[src]

Returns the ReplyBody in this request, or None if this message is not a RPC response.

Trait Implementations

impl<T: Debug, P: Debug> Debug for RpcMessage<T, P> where
    T: AsRef<[u8]>,
    P: AsRef<[u8]>, 
[src]

impl<T: PartialEq, P: PartialEq> PartialEq<RpcMessage<T, P>> for RpcMessage<T, P> where
    T: AsRef<[u8]>,
    P: AsRef<[u8]>, 
[src]

impl<T, P> StructuralPartialEq for RpcMessage<T, P> where
    T: AsRef<[u8]>,
    P: AsRef<[u8]>, 
[src]

impl<'a> TryFrom<&'a [u8]> for RpcMessage<&'a [u8], &'a [u8]>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Bytes> for RpcMessage<Bytes, Bytes>[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<T, P> RefUnwindSafe for RpcMessage<T, P> where
    P: RefUnwindSafe,
    T: RefUnwindSafe
[src]

impl<T, P> Send for RpcMessage<T, P> where
    P: Send,
    T: Send
[src]

impl<T, P> Sync for RpcMessage<T, P> where
    P: Sync,
    T: Sync
[src]

impl<T, P> Unpin for RpcMessage<T, P> where
    P: Unpin,
    T: Unpin
[src]

impl<T, P> UnwindSafe for RpcMessage<T, P> where
    P: UnwindSafe,
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.