Struct sequoia_openpgp::parse::Cookie
source · pub struct Cookie { /* private fields */ }
Expand description
Private state used by the PacketParser
.
This is not intended to be used. It is possible to explicitly
create Cookie
instances using its Default
implementation for
low-level interfacing with parsing code.
Trait Implementations§
source§impl<'a> BufferedReader<Cookie> for PacketParser<'a>
impl<'a> BufferedReader<Cookie> for PacketParser<'a>
This interface allows a caller to read the content of a
PacketParser
using the BufferedReader
interface. This is
essential to supporting streaming operation.
Note: it is safe to mix the use of the std::io::Read
and
BufferedReader
interfaces.
source§fn data(&mut self, amount: usize) -> Result<&[u8]>
fn data(&mut self, amount: usize) -> Result<&[u8]>
Ensures that the internal buffer has at least
amount
bytes
of data, and returns it. Read moresource§fn data_hard(&mut self, amount: usize) -> Result<&[u8]>
fn data_hard(&mut self, amount: usize) -> Result<&[u8]>
Like
BufferedReader::data
, but returns an error if there is not at least
amount
bytes available. Read moresource§fn data_eof(&mut self) -> Result<&[u8]>
fn data_eof(&mut self) -> Result<&[u8]>
Returns all of the data until EOF. Like
BufferedReader::data
, this does not
actually consume the data that is read. Read moresource§fn data_consume_hard(&mut self, amount: usize) -> Result<&[u8]>
fn data_consume_hard(&mut self, amount: usize) -> Result<&[u8]>
A convenience function that effectively combines
BufferedReader::data_hard
and BufferedReader::consume
. Read moresource§fn steal(&mut self, amount: usize) -> Result<Vec<u8>>
fn steal(&mut self, amount: usize) -> Result<Vec<u8>>
Like
BufferedReader::data_consume_hard
, but returns the data in a
caller-owned buffer. Read moresource§fn steal_eof(&mut self) -> Result<Vec<u8>>
fn steal_eof(&mut self) -> Result<Vec<u8>>
Like
BufferedReader::steal
, but instead of stealing a fixed number of
bytes, steals all of the data until the end of file.source§fn get_mut(&mut self) -> Option<&mut dyn BufferedReader<Cookie>>
fn get_mut(&mut self) -> Option<&mut dyn BufferedReader<Cookie>>
Returns a mutable reference to the inner
BufferedReader
, if
any. Read moresource§fn get_ref(&self) -> Option<&dyn BufferedReader<Cookie>>
fn get_ref(&self) -> Option<&dyn BufferedReader<Cookie>>
Returns a reference to the inner
BufferedReader
, if any.source§fn into_inner<'b>(
self: Box<Self>,
) -> Option<Box<dyn BufferedReader<Cookie> + 'b>>where
Self: 'b,
fn into_inner<'b>(
self: Box<Self>,
) -> Option<Box<dyn BufferedReader<Cookie> + 'b>>where
Self: 'b,
Returns the underlying reader, if any. Read more
Sets the
BufferedReader
’s cookie and returns the old value.Returns a reference to the
BufferedReader
’s cookie.Returns a mutable reference to the
BufferedReader
’s cookie.source§fn consummated(&mut self) -> bool
fn consummated(&mut self) -> bool
Checks whether this reader is consummated. Read more
source§fn read_be_u16(&mut self) -> Result<u16, Error>
fn read_be_u16(&mut self) -> Result<u16, Error>
A convenience function for reading a 16-bit unsigned integer
in big endian format.
source§fn read_be_u32(&mut self) -> Result<u32, Error>
fn read_be_u32(&mut self) -> Result<u32, Error>
A convenience function for reading a 32-bit unsigned integer
in big endian format.
source§fn read_to(&mut self, terminal: u8) -> Result<&[u8], Error>
fn read_to(&mut self, terminal: u8) -> Result<&[u8], Error>
Reads until either
terminal
is encountered or EOF. Read moresource§fn drop_until(&mut self, terminals: &[u8]) -> Result<usize, Error>
fn drop_until(&mut self, terminals: &[u8]) -> Result<usize, Error>
Discards the input until one of the bytes in terminals is
encountered. Read more
source§fn drop_through(
&mut self,
terminals: &[u8],
match_eof: bool,
) -> Result<(Option<u8>, usize), Error>
fn drop_through( &mut self, terminals: &[u8], match_eof: bool, ) -> Result<(Option<u8>, usize), Error>
Discards the input until one of the bytes in
terminals
is
encountered. Read moresource§fn drop_eof(&mut self) -> Result<bool, Error>
fn drop_eof(&mut self) -> Result<bool, Error>
Like
BufferedReader::steal_eof
, but instead of returning the data, the
data is discarded. Read moresource§fn copy(&mut self, sink: &mut dyn Write) -> Result<u64, Error>
fn copy(&mut self, sink: &mut dyn Write) -> Result<u64, Error>
Copies data to the given writer returning the copied amount. Read more
source§fn dump(&self, sink: &mut dyn Write) -> Result<(), Error>where
Self: Sized,
fn dump(&self, sink: &mut dyn Write) -> Result<(), Error>where
Self: Sized,
A helpful debugging aid to pretty print a Buffered Reader stack. Read more
source§fn into_boxed<'a>(self) -> Box<dyn BufferedReader<C> + 'a>where
Self: Sized + 'a,
fn into_boxed<'a>(self) -> Box<dyn BufferedReader<C> + 'a>where
Self: Sized + 'a,
Boxes the reader.
source§impl BufferedReader<Cookie> for Reader<'_>
impl BufferedReader<Cookie> for Reader<'_>
source§fn data(&mut self, amount: usize) -> Result<&[u8]>
fn data(&mut self, amount: usize) -> Result<&[u8]>
Ensures that the internal buffer has at least
amount
bytes
of data, and returns it. Read moresource§fn data_hard(&mut self, amount: usize) -> Result<&[u8]>
fn data_hard(&mut self, amount: usize) -> Result<&[u8]>
Like
BufferedReader::data
, but returns an error if there is not at least
amount
bytes available. Read moresource§fn data_consume_hard(&mut self, amount: usize) -> Result<&[u8]>
fn data_consume_hard(&mut self, amount: usize) -> Result<&[u8]>
A convenience function that effectively combines
BufferedReader::data_hard
and BufferedReader::consume
. Read moresource§fn get_mut(&mut self) -> Option<&mut dyn BufferedReader<Cookie>>
fn get_mut(&mut self) -> Option<&mut dyn BufferedReader<Cookie>>
Returns a mutable reference to the inner
BufferedReader
, if
any. Read moresource§fn get_ref(&self) -> Option<&dyn BufferedReader<Cookie>>
fn get_ref(&self) -> Option<&dyn BufferedReader<Cookie>>
Returns a reference to the inner
BufferedReader
, if any.source§fn into_inner<'b>(
self: Box<Self>,
) -> Option<Box<dyn BufferedReader<Cookie> + 'b>>where
Self: 'b,
fn into_inner<'b>(
self: Box<Self>,
) -> Option<Box<dyn BufferedReader<Cookie> + 'b>>where
Self: 'b,
Returns the underlying reader, if any. Read more
Sets the
BufferedReader
’s cookie and returns the old value.Returns a reference to the
BufferedReader
’s cookie.Returns a mutable reference to the
BufferedReader
’s cookie.source§fn data_eof(&mut self) -> Result<&[u8], Error>
fn data_eof(&mut self) -> Result<&[u8], Error>
Returns all of the data until EOF. Like
BufferedReader::data
, this does not
actually consume the data that is read. Read moresource§fn consummated(&mut self) -> bool
fn consummated(&mut self) -> bool
Checks whether this reader is consummated. Read more
source§fn read_be_u16(&mut self) -> Result<u16, Error>
fn read_be_u16(&mut self) -> Result<u16, Error>
A convenience function for reading a 16-bit unsigned integer
in big endian format.
source§fn read_be_u32(&mut self) -> Result<u32, Error>
fn read_be_u32(&mut self) -> Result<u32, Error>
A convenience function for reading a 32-bit unsigned integer
in big endian format.
source§fn read_to(&mut self, terminal: u8) -> Result<&[u8], Error>
fn read_to(&mut self, terminal: u8) -> Result<&[u8], Error>
Reads until either
terminal
is encountered or EOF. Read moresource§fn drop_until(&mut self, terminals: &[u8]) -> Result<usize, Error>
fn drop_until(&mut self, terminals: &[u8]) -> Result<usize, Error>
Discards the input until one of the bytes in terminals is
encountered. Read more
source§fn drop_through(
&mut self,
terminals: &[u8],
match_eof: bool,
) -> Result<(Option<u8>, usize), Error>
fn drop_through( &mut self, terminals: &[u8], match_eof: bool, ) -> Result<(Option<u8>, usize), Error>
Discards the input until one of the bytes in
terminals
is
encountered. Read moresource§fn steal(&mut self, amount: usize) -> Result<Vec<u8>, Error>
fn steal(&mut self, amount: usize) -> Result<Vec<u8>, Error>
Like
BufferedReader::data_consume_hard
, but returns the data in a
caller-owned buffer. Read moresource§fn steal_eof(&mut self) -> Result<Vec<u8>, Error>
fn steal_eof(&mut self) -> Result<Vec<u8>, Error>
Like
BufferedReader::steal
, but instead of stealing a fixed number of
bytes, steals all of the data until the end of file.source§fn drop_eof(&mut self) -> Result<bool, Error>
fn drop_eof(&mut self) -> Result<bool, Error>
Like
BufferedReader::steal_eof
, but instead of returning the data, the
data is discarded. Read moresource§fn copy(&mut self, sink: &mut dyn Write) -> Result<u64, Error>
fn copy(&mut self, sink: &mut dyn Write) -> Result<u64, Error>
Copies data to the given writer returning the copied amount. Read more
source§fn dump(&self, sink: &mut dyn Write) -> Result<(), Error>where
Self: Sized,
fn dump(&self, sink: &mut dyn Write) -> Result<(), Error>where
Self: Sized,
A helpful debugging aid to pretty print a Buffered Reader stack. Read more
source§fn into_boxed<'a>(self) -> Box<dyn BufferedReader<C> + 'a>where
Self: Sized + 'a,
fn into_boxed<'a>(self) -> Box<dyn BufferedReader<C> + 'a>where
Self: Sized + 'a,
Boxes the reader.
Auto Trait Implementations§
impl Freeze for Cookie
impl !RefUnwindSafe for Cookie
impl Send for Cookie
impl Sync for Cookie
impl Unpin for Cookie
impl !UnwindSafe for Cookie
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more