Trait IntoWithoutComments

Source
pub trait IntoWithoutComments
where Self: Sized + Iterator<Item = char>,
{ // Provided method fn without_comments(self, language: Box<[Comment]>) -> WithoutComments<Self> { ... } }
Expand description

A trait to implement the without_comments method on all Iterator<Item=char>

Provided Methods§

Source

fn without_comments(self, language: Box<[Comment]>) -> WithoutComments<Self>

Returns a WithoutComments iterator containing self

§Arguments
  • language - A boxed slice containing all the comments that the returned iterator will be removing
§Example
use no_comment::{IntoWithoutComments, languages};
let with_comments = "S/*he */be/*lie*/ve//d";
let without_comments = with_comments
    .chars()
    .without_comments(languages::rust())
    .collect::<String>();
assert_eq!(&without_comments, "Sbeve");

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§

Source§

impl<I: Iterator<Item = char>> IntoWithoutComments for I

Blanket implementation