type StaticStr = &'static str;

Trait Implementations§

§

impl Arg for &str

§

fn as_str(&self) -> Result<&str, Errno>

Returns a view of this string as a string slice.
§

fn to_string_lossy(&self) -> Cow<'_, str>

Returns a potentially-lossy rendering of this string as a Cow<'_, str>.
§

fn as_cow_c_str(&self) -> Result<Cow<'_, CStr>, Errno>

Returns a view of this string as a maybe-owned CStr.
§

fn into_c_str<'b>(self) -> Result<Cow<'b, CStr>, Errno>where &str: 'b,

Consumes self and returns a view of this string as a maybe-owned CStr.
§

fn into_with_c_str<T, F>(self, f: F) -> Result<T, Errno>where &str: Sized, F: FnOnce(&CStr) -> Result<T, Errno>,

Runs a closure with self passed in as a &CStr.
1.0.0 · source§

impl Default for &str

source§

fn default() -> &str

Creates an empty str

source§

impl<'de, 'a> Deserialize<'de> for &'a strwhere 'de: 'a,

source§

fn deserialize<D>( deserializer: D ) -> Result<&'a str, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
1.0.0 · source§

impl !Error for &str

1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl<'a> Expected for &'a str

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result<(), Error>

Format an explanation of what data was being expected. Same signature as the Display and Debug traits.
§

impl<'_derivative_strum> From<&'_derivative_strum ConsensusType> for &'static str

§

fn from(x: &'_derivative_strum ConsensusType) -> &'static str

Converts to this type from the input type.
§

impl From<ConsensusType> for &'static str

§

fn from(x: ConsensusType) -> &'static str

Converts to this type from the input type.
§

impl<'h> From<Match<'h>> for &'h str

§

fn from(m: Match<'h>) -> &'h str

Converts to this type from the input type.
§

impl From<StringParam> for &'static str

§

fn from(x: StringParam) -> &'static str

Converts to this type from the input type.
source§

impl<'de, 'a, E> IntoDeserializer<'de, E> for &'a strwhere E: Error,

§

type Deserializer = StrDeserializer<'a, E>

The type of the deserializer being converted into.
source§

fn into_deserializer(self) -> StrDeserializer<'a, E>

Convert this value into a deserializer.
source§

impl<'a> PartialEq<Authority> for &'a str

source§

fn eq(&self, other: &Authority) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<Bytes> for &str

§

fn eq(&self, other: &Bytes) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<BytesMut> for &str

§

fn eq(&self, other: &BytesMut) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
1.0.0 · source§

impl<'a, 'b> PartialEq<Cow<'a, str>> for &'b str

source§

fn eq(&self, other: &Cow<'a, str>) -> bool

This method tests for self and other values to be equal, and is used by ==.
source§

fn ne(&self, other: &Cow<'a, str>) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<HeaderName> for &'a str

source§

fn eq(&self, other: &HeaderName) -> bool

Performs a case-insensitive comparison of the string against the header name

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<HeaderValue> for &'a str

source§

fn eq(&self, other: &HeaderValue) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<Method> for &'a str

source§

fn eq(&self, other: &Method) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
1.29.0 · source§

impl<'a> PartialEq<OsString> for &'a str

source§

fn eq(&self, other: &OsString) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<PathAndQuery> for &'a str

source§

fn eq(&self, other: &PathAndQuery) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
1.0.0 · source§

impl<'a, 'b> PartialEq<String> for &'a str

source§

fn eq(&self, other: &String) -> bool

This method tests for self and other values to be equal, and is used by ==.
source§

fn ne(&self, other: &String) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<Uri> for &'a str

source§

fn eq(&self, uri: &Uri) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialOrd<Authority> for &'a str

source§

fn partial_cmp(&self, other: &Authority) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl PartialOrd<Bytes> for &str

§

fn partial_cmp(&self, other: &Bytes) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl PartialOrd<BytesMut> for &str

§

fn partial_cmp(&self, other: &BytesMut) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a> PartialOrd<HeaderValue> for &'a str

source§

fn partial_cmp(&self, other: &HeaderValue) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a> PartialOrd<PathAndQuery> for &'a str

source§

fn partial_cmp(&self, other: &PathAndQuery) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, 'b> Pattern<'a> for &'b str

Non-allocating substring search.

Will handle the pattern "" as returning empty matches at each character boundary.

Examples

assert_eq!("Hello world".find("world"), Some(6));
source§

fn is_prefix_of(self, haystack: &'a str) -> bool

🔬This is a nightly-only experimental API. (pattern)

Checks whether the pattern matches at the front of the haystack.

source§

fn is_contained_in(self, haystack: &'a str) -> bool

🔬This is a nightly-only experimental API. (pattern)

Checks whether the pattern matches anywhere in the haystack

source§

fn strip_prefix_of(self, haystack: &'a str) -> Option<&'a str>

🔬This is a nightly-only experimental API. (pattern)

Removes the pattern from the front of haystack, if it matches.

source§

fn is_suffix_of(self, haystack: &'a str) -> bool

🔬This is a nightly-only experimental API. (pattern)

Checks whether the pattern matches at the back of the haystack.

source§

fn strip_suffix_of(self, haystack: &'a str) -> Option<&'a str>

🔬This is a nightly-only experimental API. (pattern)

Removes the pattern from the back of haystack, if it matches.

§

type Searcher = StrSearcher<'a, 'b>

🔬This is a nightly-only experimental API. (pattern)
Associated searcher for this pattern
source§

fn into_searcher(self, haystack: &'a str) -> StrSearcher<'a, 'b>

🔬This is a nightly-only experimental API. (pattern)
Constructs the associated searcher from self and the haystack to search in.
§

impl<'a> Replacer for &'a str

§

fn replace_append(&mut self, caps: &Captures<'_>, dst: &mut String)

Appends possibly empty data to dst to replace the current match. Read more
§

fn no_expansion(&mut self) -> Option<Cow<'_, str>>

Return a fixed unchanging replacement string. Read more
§

fn by_ref<'r>(&'r mut self) -> ReplacerRef<'r, Self>

Returns a type that implements Replacer, but that borrows and wraps this Replacer. Read more
1.72.0 · source§

impl<'a> TryFrom<&'a OsStr> for &'a str

source§

fn try_from( value: &'a OsStr ) -> Result<&'a str, <&'a str as TryFrom<&'a OsStr>>::Error>

Tries to convert an &OsStr to a &str.

use std::ffi::OsStr;

let os_str = OsStr::new("foo");
let as_str = <&str>::try_from(os_str).unwrap();
assert_eq!(as_str, "foo");
§

type Error = Utf8Error

The type returned in the event of a conversion error.
§

impl<'a> UnicodeNormalization<Chars<'a>> for &'a str

§

fn nfd(self) -> Decompositions<Chars<'a>>

Returns an iterator over the string in Unicode Normalization Form D (canonical decomposition).
§

fn nfkd(self) -> Decompositions<Chars<'a>>

Returns an iterator over the string in Unicode Normalization Form KD (compatibility decomposition).
§

fn nfc(self) -> Recompositions<Chars<'a>>

An Iterator over the string in Unicode Normalization Form C (canonical decomposition followed by canonical composition).
§

fn nfkc(self) -> Recompositions<Chars<'a>>

An Iterator over the string in Unicode Normalization Form KC (compatibility decomposition followed by canonical composition).
§

fn cjk_compat_variants(self) -> Replacements<Chars<'a>>

A transformation which replaces CJK Compatibility Ideograph codepoints with normal forms using Standardized Variation Sequences. This is not part of the canonical or compatibility decomposition algorithms, but performing it before those algorithms produces normalized output which better preserves the intent of the original text. Read more
§

fn stream_safe(self) -> StreamSafe<Chars<'a>>

An Iterator over the string with Conjoining Grapheme Joiner characters inserted according to the Stream-Safe Text Process (UAX15-D4)
source§

impl<'a> AsHeaderName for &'a str

source§

impl IntoHeaderName for &'static str