rustls_pemfile

Function read_one

source
pub fn read_one(rd: &mut dyn BufRead) -> Result<Option<Item>, Error>
Expand description

Extract and decode the next PEM section from rd.

  • Ok(None) is returned if there is no PEM section read from rd.
  • Underlying IO errors produce a Err(...)
  • Otherwise each decoded section is returned with a Ok(Some(Item::...))

You can use this function to build an iterator, for example: for item in iter::from_fn(|| read_one(rd).transpose()) { ... }