pub enum PyConst {
None,
True,
False,
Ellipsis,
Int(String),
Float(String),
Str {
value: String,
quote: char,
u_prefix: bool,
},
Bytes(Vec<u8>),
}Expand description
ast.Constant values. Numeric payloads are kept as normalized
strings (what repr(value) prints), so arbitrary-precision ints
survive and floats carry Python’s shortest-repr text.
Variants§
None
True
False
Ellipsis
Int(String)
Normalized decimal digits, no sign, no underscores (0xFF → 255).
Float(String)
Python repr(float) text (1e-3 → 0.001, 1e16 → 1e+16).
Str
A str constant. value is the decoded content; quote is the
quote character repr() chooses for it (recomputed by unparse,
stored here so doctree consumers agree with the rendered text);
u_prefix preserves ast.Constant.kind == 'u' (u'x' unparses as
u'x').
Bytes(Vec<u8>)
A bytes constant: decoded bytes.
Trait Implementations§
impl Eq for PyConst
impl StructuralPartialEq for PyConst
Auto Trait Implementations§
impl Freeze for PyConst
impl RefUnwindSafe for PyConst
impl Send for PyConst
impl Sync for PyConst
impl Unpin for PyConst
impl UnsafeUnpin for PyConst
impl UnwindSafe for PyConst
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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 more