Struct parse_hyperlinks::iterator_html::InlineImage[][src]

pub struct InlineImage<'a> { /* fields omitted */ }

Iterator over the inline images in the HTML formatted input text. This struct holds the iterator’s state, as an advancing pointer into the input text. The iterator’s next() method returns a tuple with 2 tuples inside: Some(((input_split)(html_image_element))).

Each tuple has the following parts:

  • input_split = (skipped_characters, consumed_characters, remaining_characters)
  • html_image_elemet = (img_src, img_alt)

Input split

use parse_hyperlinks::iterator_html::InlineImage;
use std::borrow::Cow;

let i = r#"abc<img src="dest1" alt="text1">efg<img src="dest2" alt="text2">hij"#;

let mut iter = InlineImage::new(i);
assert_eq!(iter.next().unwrap().0, ("abc", r#"<img src="dest1" alt="text1">"#,
      r#"efg<img src="dest2" alt="text2">hij"#));
assert_eq!(iter.next().unwrap().0, ("efg", r#"<img src="dest2" alt="text2">"#,
      "hij"));
assert_eq!(iter.next(), None);

Link content

HTML

use parse_hyperlinks::iterator_html::InlineImage;
use std::borrow::Cow;

let i = r#"abc<img src="dest1" alt="text1">abc
abc<img src="dest2" alt="text2">abc
"#;

let mut iter = InlineImage::new(i);
assert_eq!(iter.next().unwrap().1, (Cow::from("text1"), Cow::from("dest1")));
assert_eq!(iter.next().unwrap().1, (Cow::from("text2"), Cow::from("dest2")));
assert_eq!(iter.next(), None);

Implementations

impl<'a> InlineImage<'a>[src]

Constructor for the Hyperlink struct.

pub fn new(input: &'a str) -> Self[src]

Constructor for the iterator. input is the text with inline images to be extracted.

Trait Implementations

impl<'a> Debug for InlineImage<'a>[src]

impl<'a> Iterator for InlineImage<'a>[src]

Iterator over the HTML inline images in the input-text. The iterator’s next() method returns a tuple with 2 tuples inside:

  • Some(((input_split)(link_content)))

Each tuple has the following parts:

  • input_split = (skipped_characters, consumed_characters, remaining_characters)
  • link_content = (image_alt, image_src)

type Item = ((&'a str, &'a str, &'a str), (Cow<'a, str>, Cow<'a, str>))

The type of the elements being iterated over.

impl<'a> PartialEq<InlineImage<'a>> for InlineImage<'a>[src]

impl<'a> StructuralPartialEq for InlineImage<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for InlineImage<'a>

impl<'a> Send for InlineImage<'a>

impl<'a> Sync for InlineImage<'a>

impl<'a> Unpin for InlineImage<'a>

impl<'a> UnwindSafe for InlineImage<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.