pub enum StringLiteralPrefix {
Empty,
Unicode,
Raw {
uppercase: bool,
},
}Expand description
Enumerations of the valid prefixes a string literal can have.
Bytestrings and f-strings are excluded from this enumeration, as they are represented by different AST nodes.
Variants§
Empty
Just a regular string with no prefixes
Unicode
A string with a u or U prefix, e.g. u"foo".
Note that, despite this variant’s name,
it is in fact a no-op at runtime to use the u or U prefix
in Python. All Python-3 strings are unicode strings;
this prefix is only allowed in Python 3 for backwards compatibility
with Python 2. However, using this prefix in a Python string
is mutually exclusive with an r or R prefix.
Raw
A “raw” string, that has an r or R prefix,
e.g. r"foo\." or R'bar\d'.
Implementations§
Trait Implementations§
Source§impl Clone for StringLiteralPrefix
impl Clone for StringLiteralPrefix
Source§fn clone(&self) -> StringLiteralPrefix
fn clone(&self) -> StringLiteralPrefix
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StringLiteralPrefix
impl Debug for StringLiteralPrefix
Source§impl Display for StringLiteralPrefix
impl Display for StringLiteralPrefix
Source§impl Hash for StringLiteralPrefix
impl Hash for StringLiteralPrefix
Source§impl PartialEq for StringLiteralPrefix
impl PartialEq for StringLiteralPrefix
impl Copy for StringLiteralPrefix
impl Eq for StringLiteralPrefix
impl StructuralPartialEq for StringLiteralPrefix
Auto Trait Implementations§
impl Freeze for StringLiteralPrefix
impl RefUnwindSafe for StringLiteralPrefix
impl Send for StringLiteralPrefix
impl Sync for StringLiteralPrefix
impl Unpin for StringLiteralPrefix
impl UnsafeUnpin for StringLiteralPrefix
impl UnwindSafe for StringLiteralPrefix
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more