Trait CrlfSuppressorExt

Source
pub trait CrlfSuppressorExt: Iterator<Item = Result<u8>> + Sized {
    // Provided method
    fn crlf_suppressor(self) -> CrlfSuppressor<Self>  { ... }
}
Expand description

Extension trait to add .crlf_suppressor() to any iterator over bytes.

§Example

use std::io::{Cursor, Error, Read};
use tpnote_lib::text_reader::CrlfSuppressorExt;

let data = b"hello\r\nworld";
let normalized: Result<Vec<u8>, Error> = Cursor::new(data)
    .bytes()
    .crlf_suppressor()
    .collect();
let s = String::from_utf8(normalized.unwrap()).unwrap();
assert_eq!(s, "hello\nworld");

Provided Methods§

Source

fn crlf_suppressor(self) -> CrlfSuppressor<Self>

Returns an iterator that suppresses CRLF sequences.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§