#[non_exhaustive]pub enum PyStaticExpr {
Constant {
value: PyStaticConstant,
},
Name {
id: &'static str,
},
Attribute {
value: &'static Self,
attr: &'static str,
},
BinOp {
left: &'static Self,
op: PyStaticOperator,
right: &'static Self,
},
Tuple {
elts: &'static [Self],
},
List {
elts: &'static [Self],
},
Subscript {
value: &'static Self,
slice: &'static Self,
},
PyClass(PyClassNameStaticExpr),
}Expand description
A Python expression.
This is the expr production of the Python ast module grammar
This struct aims at being used in const contexts like in FromPyObject::INPUT_TYPE and IntoPyObject::OUTPUT_TYPE.
Use macros like type_hint_identifier, type_hint_union and type_hint_subscript to construct values.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Constant
A constant like None or 123
Fields
§
value: PyStaticConstantName
A name
Attribute
An attribute value.attr
BinOp
A binary operator
Tuple
A tuple
Fields
§
elts: &'static [Self]List
A list
Fields
§
elts: &'static [Self]Subscript
A subscript value[slice]
PyClass(PyClassNameStaticExpr)
A #[pyclass] type. This is separated type for introspection reasons.
Trait Implementations§
Source§impl AsRef<PyStaticExpr> for PyClassNameStaticExpr
impl AsRef<PyStaticExpr> for PyClassNameStaticExpr
Source§fn as_ref(&self) -> &PyStaticExpr
fn as_ref(&self) -> &PyStaticExpr
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Clone for PyStaticExpr
impl Clone for PyStaticExpr
Source§fn clone(&self) -> PyStaticExpr
fn clone(&self) -> PyStaticExpr
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 Display for PyStaticExpr
impl Display for PyStaticExpr
impl Copy for PyStaticExpr
Auto Trait Implementations§
impl Freeze for PyStaticExpr
impl RefUnwindSafe for PyStaticExpr
impl Send for PyStaticExpr
impl Sync for PyStaticExpr
impl Unpin for PyStaticExpr
impl UnwindSafe for PyStaticExpr
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 more