[−][src]Struct onc_rpc::RpcMessage
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]
buf: &'a [u8]
) -> Result<RpcMessage<&'a [u8], &'a [u8]>, Error>
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]
T: AsRef<[u8]>,
P: AsRef<[u8]>,
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]
T: AsRef<[u8]>,
P: AsRef<[u8]>,
impl<T: PartialEq, P: PartialEq> PartialEq<RpcMessage<T, P>> for RpcMessage<T, P> where
T: AsRef<[u8]>,
P: AsRef<[u8]>,
[src]
T: AsRef<[u8]>,
P: AsRef<[u8]>,
pub fn eq(&self, other: &RpcMessage<T, P>) -> bool
[src]
pub fn ne(&self, other: &RpcMessage<T, P>) -> bool
[src]
impl<T, P> StructuralPartialEq for RpcMessage<T, P> where
T: AsRef<[u8]>,
P: AsRef<[u8]>,
[src]
T: AsRef<[u8]>,
P: AsRef<[u8]>,
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.
pub fn try_from(v: &'a [u8]) -> Result<Self, Self::Error>
[src]
impl TryFrom<Bytes> for RpcMessage<Bytes, Bytes>
[src]
Auto Trait Implementations
impl<T, P> RefUnwindSafe for RpcMessage<T, P> where
P: RefUnwindSafe,
T: RefUnwindSafe,
[src]
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, P> Send for RpcMessage<T, P> where
P: Send,
T: Send,
[src]
P: Send,
T: Send,
impl<T, P> Sync for RpcMessage<T, P> where
P: Sync,
T: Sync,
[src]
P: Sync,
T: Sync,
impl<T, P> Unpin for RpcMessage<T, P> where
P: Unpin,
T: Unpin,
[src]
P: Unpin,
T: Unpin,
impl<T, P> UnwindSafe for RpcMessage<T, P> where
P: UnwindSafe,
T: UnwindSafe,
[src]
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,