1.0.0[−][src]Module nom::lib::std::str
Unicode string slices.
See also the str
primitive type.
The &str
type is one of the two main string types, the other being String
.
Unlike its String
counterpart, its contents are borrowed.
Basic Usage
A basic string declaration of &str
type:
let hello_world = "Hello, World!";
Here we have declared a string literal, also known as a string slice.
String literals have a static lifetime, which means the string hello_world
is guaranteed to be valid for the duration of the entire program.
We can explicitly specify hello_world
's lifetime as well:
let hello_world: &'static str = "Hello, world!";
Modules
pattern | Experimental The string Pattern API. |
Structs
Bytes | An iterator over the bytes of a string slice. |
CharIndices | An iterator over the |
Chars | An iterator over the |
EncodeUtf16 | An iterator of |
EscapeDebug | The return type of |
EscapeDefault | The return type of |
EscapeUnicode | The return type of |
Lines | An iterator over the lines of a string, as string slices. |
LinesAny | Deprecated Created with the method |
MatchIndices | Created with the method |
Matches | Created with the method |
ParseBoolError | An error returned when parsing a |
RMatchIndices | Created with the method |
RMatches | Created with the method |
RSplit | Created with the method |
RSplitN | Created with the method |
RSplitTerminator | Created with the method |
Split | Created with the method |
SplitAsciiWhitespace | An iterator over the non-ASCII-whitespace substrings of a string, separated by any amount of ASCII whitespace. |
SplitN | Created with the method |
SplitTerminator | Created with the method |
SplitWhitespace | An iterator over the non-whitespace substrings of a string, separated by any amount of whitespace. |
Utf8Error | Errors which can occur when attempting to interpret a sequence of |
Traits
FromStr | Parse a value from a string |
Functions
from_boxed_utf8_unchecked⚠ | Converts a boxed slice of bytes to a boxed string slice without checking that the string contains valid UTF-8. |
from_utf8_mut | Converts a mutable slice of bytes to a mutable string slice. |
from_utf8 | Converts a slice of bytes to a string slice. |
from_utf8_unchecked_mut⚠ | Converts a slice of bytes to a string slice without checking that the string contains valid UTF-8; mutable version. |
from_utf8_unchecked⚠ | Converts a slice of bytes to a string slice without checking that the string contains valid UTF-8. |