pub struct DictItem {
pub key: Option<Expr>,
pub value: Expr,
}Expand description
Represents an item in a dictionary literal display.
Consider the following Python dictionary literal:
{key1: value1, **other_dictionary}In our AST, this would be represented using an ExprDict node containing
two DictItem nodes inside it:
ⓘ
[
DictItem {
key: Some(Expr::Name(ExprName { id: "key1" })),
value: Expr::Name(ExprName { id: "value1" }),
},
DictItem {
key: None,
value: Expr::Name(ExprName { id: "other_dictionary" }),
}
]Fields§
§key: Option<Expr>§value: ExprTrait Implementations§
Source§impl<'a> From<&'a DictItem> for ComparableDictItem<'a>
impl<'a> From<&'a DictItem> for ComparableDictItem<'a>
Source§fn from(_: &'a DictItem) -> ComparableDictItem<'a>
fn from(_: &'a DictItem) -> ComparableDictItem<'a>
Converts to this type from the input type.
Source§impl GetSize for DictItem
impl GetSize for DictItem
Source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Determines how many bytes this object occupies inside the heap. Read more
Source§fn get_heap_size_with_tracker<TRACKER>(
&self,
tracker: TRACKER,
) -> (usize, TRACKER)where
TRACKER: GetSizeTracker,
fn get_heap_size_with_tracker<TRACKER>(
&self,
tracker: TRACKER,
) -> (usize, TRACKER)where
TRACKER: GetSizeTracker,
Determines how many bytes this object occupies inside the heap while using a
tracker. Read moreSource§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Determines how may bytes this object occupies inside the stack. Read more
Source§fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
Determines the total size of the object while using a
tracker. Read moreimpl StructuralPartialEq for DictItem
Auto Trait Implementations§
impl !Freeze for DictItem
impl RefUnwindSafe for DictItem
impl Send for DictItem
impl Sync for DictItem
impl Unpin for DictItem
impl UnsafeUnpin for DictItem
impl UnwindSafe for DictItem
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