pub enum StringKind {
String,
FString,
Bytes,
RawString,
RawFString,
RawBytes,
Unicode,
}
Expand description
The kind of string literal as described in the String and Bytes literals section of the Python reference.
Variants§
String
A normal string literal with no prefix.
FString
A f-string literal, with a f
or F
prefix.
Bytes
A byte string literal, with a b
or B
prefix.
RawString
A raw string literal, with a r
or R
prefix.
RawFString
A raw f-string literal, with a rf
/fr
or rF
/Fr
or Rf
/fR
or RF
/FR
prefix.
RawBytes
A raw byte string literal, with a rb
/br
or rB
/Br
or Rb
/bR
or RB
/BR
prefix.
Unicode
A unicode string literal, with a u
or U
prefix.
Implementations§
Source§impl StringKind
impl StringKind
Sourcepub fn is_raw(&self) -> bool
pub fn is_raw(&self) -> bool
Returns true if the string is a raw string, i,e one of
StringKind::RawString
or StringKind::RawFString
or StringKind::RawBytes
.
Sourcepub fn is_any_fstring(&self) -> bool
pub fn is_any_fstring(&self) -> bool
Returns true if the string is an f-string, i,e one of
StringKind::FString
or StringKind::RawFString
.
Sourcepub fn is_any_bytes(&self) -> bool
pub fn is_any_bytes(&self) -> bool
Returns true if the string is a byte string, i,e one of
StringKind::Bytes
or StringKind::RawBytes
.
Sourcepub fn is_unicode(&self) -> bool
pub fn is_unicode(&self) -> bool
Returns true if the string is a unicode string, i,e StringKind::Unicode
.
Sourcepub fn prefix_len(&self) -> TextSize
pub fn prefix_len(&self) -> TextSize
Returns the number of characters in the prefix.
Trait Implementations§
Source§impl Clone for StringKind
impl Clone for StringKind
Source§fn clone(&self) -> StringKind
fn clone(&self) -> StringKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for StringKind
impl Debug for StringKind
Source§impl Display for StringKind
impl Display for StringKind
Source§impl Hash for StringKind
impl Hash for StringKind
Source§impl PartialEq for StringKind
impl PartialEq for StringKind
Source§impl TryFrom<char> for StringKind
impl TryFrom<char> for StringKind
impl Copy for StringKind
impl Eq for StringKind
impl StructuralPartialEq for StringKind
Auto Trait Implementations§
impl Freeze for StringKind
impl RefUnwindSafe for StringKind
impl Send for StringKind
impl Sync for StringKind
impl Unpin for StringKind
impl UnwindSafe for StringKind
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
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>
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 more