[][src]Function enqueuemail::page_title_from_html

pub fn page_title_from_html(
    content: &[u8]
) -> Result<Option<String>, Box<dyn Error>>

Extract the page title tag content from a raw but well formed HTML content.

The implementation of this functions is a Nom parser.

Type Definition nom::IResult.

Holds the result of parsing functions type IResult<I, O, E = (I, ErrorKind)> = Result<(I, O), Err>; It depends on I, the input type, O, the output type, and E, the error type (by default u32).

The Ok side is a pair containing the remainder of the input (the part of the data that was not parsed) and the produced value. The Err side contains an instance of nom::Err. let (, (, , title)) = match tuple::<, , VerboseError<>, _>(...

Function nom::bytes::complete::take_until

Returns the longest input slice till it matches the pattern.

It doesn't consume the pattern. It will return Err(Err::Error((_rest, ErrorKind::TakeUntil))) if the pattern wasn't met.

Function std::str::from_utf8 Converts a vector of bytes to a String.

A string (String) is made of bytes (u8), and a vector of bytes (Vec) is made of bytes, so this function converts between the two. Not all byte slices are valid Strings, however: String requires that it is valid UTF-8. from_utf8() checks to ensure that the bytes are valid UTF-8, and then does the conversion.

Also uses from_utft8.