Crate quoted_string [] [src]

This crate provides utilities to handle quoted strings like such appearing in Media Types (both MIME (i.e. Mail) and HTTP). As there are many small but significant differences in different specifications this crate does not provide a specific implementation. Instead a QuotedStringSpec trait is exposed. Implementing it (on zero-sized structs) should allow the usage with any quoted-string specification.

Modules

test_utils

provides an example implementation of QuotedStringSpec

Structs

ContentChars

A iterator over chars of the content represented by the quoted strings (PartialEq<&str>)

Parsed

the result of successfully parsing a quoted string

Traits

AsciiCaseInsensitiveEq

Analogous to PartialEq, but with ascii case insensitive equality

QuotedStringSpec

A Trait used for providing the spec of the quoted string

QuotedValidator

Used to "validate" a quoted string by calling validate_next_char on every char in order

UnquotedValidator

Used to "validate" a string by calling validate_next_char on every char in order

Functions

parse

parse a quoted string starting at the begin of input but possible ending earlier

quote

quotes the input string returning the quoted string and the used validator.

quote_if_needed

quotes the input string if needed

strip_quotes

strips quotes if they exists

to_content

converts a quoted string into it's content

validate

validates if input is a valid quoted-string