Trait soroban_env_guest::xdr::ReadXdr
pub trait ReadXdr: Sized {
// Required method
fn read_xdr<R>(r: &mut Limited<R>) -> Result<Self, Error>
where R: Read;
// Provided methods
fn read_xdr_to_end<R>(r: &mut Limited<R>) -> Result<Self, Error>
where R: Read { ... }
fn read_xdr_into<R>(&mut self, r: &mut Limited<R>) -> Result<(), Error>
where R: Read { ... }
fn read_xdr_into_to_end<R>(
&mut self,
r: &mut Limited<R>
) -> Result<(), Error>
where R: Read { ... }
fn read_xdr_iter<R>(r: &mut Limited<R>) -> ReadXdrIter<&mut R, Self> ⓘ
where R: Read { ... }
fn from_xdr(bytes: impl AsRef<[u8]>, limits: Limits) -> Result<Self, Error> { ... }
}
Required Methods§
fn read_xdr<R>(r: &mut Limited<R>) -> Result<Self, Error>where
R: Read,
fn read_xdr<R>(r: &mut Limited<R>) -> Result<Self, Error>where
R: Read,
Read the XDR and construct the type.
Read bytes from the given read implementation, decoding the bytes as XDR, and construct the type implementing this interface from those bytes.
Just enough bytes are read from the read implementation to construct the type. Any residual bytes remain in the read implementation.
All implementations should continue if the read implementation returns
ErrorKind::Interrupted
.
Use [ReadXdR: Read_xdr_to_end
] when the intent is for all bytes in the
read implementation to be consumed by the read.
Provided Methods§
fn read_xdr_to_end<R>(r: &mut Limited<R>) -> Result<Self, Error>where
R: Read,
fn read_xdr_to_end<R>(r: &mut Limited<R>) -> Result<Self, Error>where
R: Read,
Read the XDR and construct the type, and consider it an error if the read does not completely consume the read implementation.
Read bytes from the given read implementation, decoding the bytes as XDR, and construct the type implementing this interface from those bytes.
Just enough bytes are read from the read implementation to construct the type, and then confirm that no further bytes remain. To confirm no further bytes remain additional bytes are attempted to be read from the read implementation. If it is possible to read any residual bytes from the read implementation an error is returned. The read implementation may not be exhaustively read if there are residual bytes, and it is considered undefined how many residual bytes or how much of the residual buffer are consumed in this case.
All implementations should continue if the read implementation returns
ErrorKind::Interrupted
.
fn read_xdr_into<R>(&mut self, r: &mut Limited<R>) -> Result<(), Error>where
R: Read,
fn read_xdr_into<R>(&mut self, r: &mut Limited<R>) -> Result<(), Error>where
R: Read,
Read the XDR and construct the type.
Read bytes from the given read implementation, decoding the bytes as XDR, and construct the type implementing this interface from those bytes.
Just enough bytes are read from the read implementation to construct the type. Any residual bytes remain in the read implementation.
All implementations should continue if the read implementation returns
ErrorKind::Interrupted
.
Use [ReadXdR: Read_xdr_into_to_end
] when the intent is for all bytes
in the read implementation to be consumed by the read.
fn read_xdr_into_to_end<R>(&mut self, r: &mut Limited<R>) -> Result<(), Error>where
R: Read,
fn read_xdr_into_to_end<R>(&mut self, r: &mut Limited<R>) -> Result<(), Error>where
R: Read,
Read the XDR into the existing value, and consider it an error if the read does not completely consume the read implementation.
Read bytes from the given read implementation, decoding the bytes as XDR, and construct the type implementing this interface from those bytes.
Just enough bytes are read from the read implementation to construct the type, and then confirm that no further bytes remain. To confirm no further bytes remain additional bytes are attempted to be read from the read implementation. If it is possible to read any residual bytes from the read implementation an error is returned. The read implementation may not be exhaustively read if there are residual bytes, and it is considered undefined how many residual bytes or how much of the residual buffer are consumed in this case.
All implementations should continue if the read implementation returns
ErrorKind::Interrupted
.
fn read_xdr_iter<R>(r: &mut Limited<R>) -> ReadXdrIter<&mut R, Self> ⓘwhere
R: Read,
fn read_xdr_iter<R>(r: &mut Limited<R>) -> ReadXdrIter<&mut R, Self> ⓘwhere
R: Read,
Create an iterator that reads the read implementation as a stream of values that are read into the implementing type.
Read bytes from the given read implementation, decoding the bytes as XDR, and construct the type implementing this interface from those bytes.
Just enough bytes are read from the read implementation to construct the type, and then confirm that no further bytes remain. To confirm no further bytes remain additional bytes are attempted to be read from the read implementation. If it is possible to read any residual bytes from the read implementation an error is returned. The read implementation may not be exhaustively read if there are residual bytes, and it is considered undefined how many residual bytes or how much of the residual buffer are consumed in this case.
All implementations should continue if the read implementation returns
ErrorKind::Interrupted
.