Struct protobuf::stream::CodedInputStream
source · pub struct CodedInputStream<'a> { /* private fields */ }
Implementations§
source§impl<'a> CodedInputStream<'a>
impl<'a> CodedInputStream<'a>
pub fn new(read: &'a mut dyn Read) -> CodedInputStream<'a> ⓘ
pub fn from_buffered_reader(
buf_read: &'a mut dyn BufRead
) -> CodedInputStream<'a> ⓘ
pub fn from_bytes(bytes: &'a [u8]) -> CodedInputStream<'a> ⓘ
sourcepub fn set_recursion_limit(&mut self, limit: u32)
pub fn set_recursion_limit(&mut self, limit: u32)
Set the recursion limit.
pub fn pos(&self) -> u64
pub fn bytes_until_limit(&self) -> u64
pub fn read(&mut self, buf: &mut [u8]) -> ProtobufResult<()>
pub fn read_raw_byte(&mut self) -> ProtobufResult<u8>
pub fn push_limit(&mut self, limit: u64) -> ProtobufResult<u64>
pub fn pop_limit(&mut self, old_limit: u64)
pub fn eof(&mut self) -> ProtobufResult<bool>
pub fn check_eof(&mut self) -> ProtobufResult<()>
pub fn read_raw_varint64(&mut self) -> ProtobufResult<u64>
pub fn read_raw_varint32(&mut self) -> ProtobufResult<u32>
pub fn read_raw_little_endian32(&mut self) -> ProtobufResult<u32>
pub fn read_raw_little_endian64(&mut self) -> ProtobufResult<u64>
pub fn read_tag(&mut self) -> ProtobufResult<Tag>
pub fn read_tag_unpack(&mut self) -> ProtobufResult<(u32, WireType)>
pub fn read_double(&mut self) -> ProtobufResult<f64>
pub fn read_float(&mut self) -> ProtobufResult<f32>
pub fn read_int64(&mut self) -> ProtobufResult<i64>
pub fn read_int32(&mut self) -> ProtobufResult<i32>
pub fn read_uint64(&mut self) -> ProtobufResult<u64>
pub fn read_uint32(&mut self) -> ProtobufResult<u32>
pub fn read_sint64(&mut self) -> ProtobufResult<i64>
pub fn read_sint32(&mut self) -> ProtobufResult<i32>
pub fn read_fixed64(&mut self) -> ProtobufResult<u64>
pub fn read_fixed32(&mut self) -> ProtobufResult<u32>
pub fn read_sfixed64(&mut self) -> ProtobufResult<i64>
pub fn read_sfixed32(&mut self) -> ProtobufResult<i32>
pub fn read_bool(&mut self) -> ProtobufResult<bool>
pub fn read_enum<E: ProtobufEnum>(&mut self) -> ProtobufResult<E>
pub fn read_repeated_packed_double_into(
&mut self,
target: &mut Vec<f64>
) -> ProtobufResult<()>
pub fn read_repeated_packed_float_into(
&mut self,
target: &mut Vec<f32>
) -> ProtobufResult<()>
pub fn read_repeated_packed_int64_into(
&mut self,
target: &mut Vec<i64>
) -> ProtobufResult<()>
pub fn read_repeated_packed_int32_into(
&mut self,
target: &mut Vec<i32>
) -> ProtobufResult<()>
pub fn read_repeated_packed_uint64_into(
&mut self,
target: &mut Vec<u64>
) -> ProtobufResult<()>
pub fn read_repeated_packed_uint32_into(
&mut self,
target: &mut Vec<u32>
) -> ProtobufResult<()>
pub fn read_repeated_packed_sint64_into(
&mut self,
target: &mut Vec<i64>
) -> ProtobufResult<()>
pub fn read_repeated_packed_sint32_into(
&mut self,
target: &mut Vec<i32>
) -> ProtobufResult<()>
pub fn read_repeated_packed_fixed64_into(
&mut self,
target: &mut Vec<u64>
) -> ProtobufResult<()>
pub fn read_repeated_packed_fixed32_into(
&mut self,
target: &mut Vec<u32>
) -> ProtobufResult<()>
pub fn read_repeated_packed_sfixed64_into(
&mut self,
target: &mut Vec<i64>
) -> ProtobufResult<()>
pub fn read_repeated_packed_sfixed32_into(
&mut self,
target: &mut Vec<i32>
) -> ProtobufResult<()>
pub fn read_repeated_packed_bool_into(
&mut self,
target: &mut Vec<bool>
) -> ProtobufResult<()>
pub fn read_repeated_packed_enum_into<E: ProtobufEnum>(
&mut self,
target: &mut Vec<E>
) -> ProtobufResult<()>
pub fn read_unknown(
&mut self,
wire_type: WireType
) -> ProtobufResult<UnknownValue>
pub fn skip_field(&mut self, wire_type: WireType) -> ProtobufResult<()>
sourcepub fn read_raw_bytes_into(
&mut self,
count: u32,
target: &mut Vec<u8>
) -> ProtobufResult<()>
pub fn read_raw_bytes_into(
&mut self,
count: u32,
target: &mut Vec<u8>
) -> ProtobufResult<()>
Read raw bytes into the supplied vector. The vector will be resized as needed and overwritten.
sourcepub fn read_raw_bytes(&mut self, count: u32) -> ProtobufResult<Vec<u8>>
pub fn read_raw_bytes(&mut self, count: u32) -> ProtobufResult<Vec<u8>>
Read exact number of bytes
pub fn skip_raw_bytes(&mut self, count: u32) -> ProtobufResult<()>
pub fn read_bytes(&mut self) -> ProtobufResult<Vec<u8>>
pub fn read_bytes_into(&mut self, target: &mut Vec<u8>) -> ProtobufResult<()>
pub fn read_string(&mut self) -> ProtobufResult<String>
pub fn read_string_into(&mut self, target: &mut String) -> ProtobufResult<()>
pub fn merge_message<M: Message>(
&mut self,
message: &mut M
) -> ProtobufResult<()>
pub fn read_message<M: Message>(&mut self) -> ProtobufResult<M>
Trait Implementations§
source§impl<'a> BufRead for CodedInputStream<'a>
impl<'a> BufRead for CodedInputStream<'a>
source§fn fill_buf(&mut self) -> Result<&[u8]>
fn fill_buf(&mut self) -> Result<&[u8]>
Returns the contents of the internal buffer, filling it with more data
from the inner reader if it is empty. Read more
source§fn consume(&mut self, amt: usize)
fn consume(&mut self, amt: usize)
Tells this buffer that
amt
bytes have been consumed from the buffer,
so they should no longer be returned in calls to read
. Read moresource§fn has_data_left(&mut self) -> Result<bool, Error>
fn has_data_left(&mut self) -> Result<bool, Error>
🔬This is a nightly-only experimental API. (
buf_read_has_data_left
)Check if the underlying
Read
has any data left to be read. Read more1.0.0 · source§fn read_until(
&mut self,
byte: u8,
buf: &mut Vec<u8, Global>
) -> Result<usize, Error>
fn read_until(
&mut self,
byte: u8,
buf: &mut Vec<u8, Global>
) -> Result<usize, Error>
1.0.0 · source§fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>
Read all bytes until a newline (the
0xA
byte) is reached, and append
them to the provided buffer. You do not need to clear the buffer before
appending. Read moresource§impl<'a> Read for CodedInputStream<'a>
impl<'a> Read for CodedInputStream<'a>
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning
how many bytes were read. Read more
1.36.0 · source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
Like
read
, except that it reads into a slice of buffers. Read moresource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
)1.0.0 · source§fn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
Read all bytes until EOF in this source, placing them into
buf
. Read more1.0.0 · source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
Read all bytes until EOF in this source, appending them to
buf
. Read more1.6.0 · source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
Read the exact number of bytes required to fill
buf
. Read moresource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf
)Pull some bytes from this source into the specified buffer. Read more
source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf
)Read the exact number of bytes required to fill
cursor
. Read more1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Creates a “by reference” adaptor for this instance of
Read
. Read more