pub struct OptionalOperation { /* private fields */ }Expand description
Operation within an Optional chain.
An operation within an Optional chain can be either shorted or non-shorted. A shorted operation
(?.item) will force the expression to return undefined if the target is undefined or null.
In contrast, a non-shorted operation (.prop) will try to access the property, even if the target
is undefined or null.
Implementations§
Source§impl OptionalOperation
impl OptionalOperation
Sourcepub const fn new(kind: OptionalOperationKind, shorted: bool, span: Span) -> Self
pub const fn new(kind: OptionalOperationKind, shorted: bool, span: Span) -> Self
Creates a new OptionalOperation.
Sourcepub const fn kind(&self) -> &OptionalOperationKind
pub const fn kind(&self) -> &OptionalOperationKind
Gets the kind of operation.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for OptionalOperation
impl<'arbitrary> Arbitrary<'arbitrary> for OptionalOperation
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§impl Clone for OptionalOperation
impl Clone for OptionalOperation
Source§fn clone(&self) -> OptionalOperation
fn clone(&self) -> OptionalOperation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 OptionalOperation
impl Debug for OptionalOperation
Source§impl<'de> Deserialize<'de> for OptionalOperation
impl<'de> Deserialize<'de> for OptionalOperation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> From<&'a OptionalOperation> for NodeRef<'a>
impl<'a> From<&'a OptionalOperation> for NodeRef<'a>
Source§fn from(node: &'a OptionalOperation) -> NodeRef<'a>
fn from(node: &'a OptionalOperation) -> NodeRef<'a>
Converts to this type from the input type.
Source§impl<'a> From<&'a mut OptionalOperation> for NodeRefMut<'a>
impl<'a> From<&'a mut OptionalOperation> for NodeRefMut<'a>
Source§fn from(node: &'a mut OptionalOperation) -> NodeRefMut<'a>
fn from(node: &'a mut OptionalOperation) -> NodeRefMut<'a>
Converts to this type from the input type.
Source§impl PartialEq for OptionalOperation
impl PartialEq for OptionalOperation
Source§impl Serialize for OptionalOperation
impl Serialize for OptionalOperation
Source§impl Spanned for OptionalOperation
impl Spanned for OptionalOperation
impl StructuralPartialEq for OptionalOperation
Source§impl ToInternedString for OptionalOperation
impl ToInternedString for OptionalOperation
Source§fn to_interned_string(&self, interner: &Interner) -> String
fn to_interned_string(&self, interner: &Interner) -> String
Converts a given element to a string using an interner.
Source§impl VisitWith for OptionalOperation
impl VisitWith for OptionalOperation
Source§fn visit_with<'a, V>(&'a self, visitor: &mut V) -> ControlFlow<V::BreakTy>where
V: Visitor<'a>,
fn visit_with<'a, V>(&'a self, visitor: &mut V) -> ControlFlow<V::BreakTy>where
V: Visitor<'a>,
Visit this node with the provided visitor.
Source§fn visit_with_mut<'a, V>(
&'a mut self,
visitor: &mut V,
) -> ControlFlow<V::BreakTy>where
V: VisitorMut<'a>,
fn visit_with_mut<'a, V>(
&'a mut self,
visitor: &mut V,
) -> ControlFlow<V::BreakTy>where
V: VisitorMut<'a>,
Visit this node with the provided visitor mutably, allowing the visitor to modify private
fields.
Auto Trait Implementations§
impl !RefUnwindSafe for OptionalOperation
impl !Send for OptionalOperation
impl !Sync for OptionalOperation
impl !UnwindSafe for OptionalOperation
impl Freeze for OptionalOperation
impl Unpin for OptionalOperation
impl UnsafeUnpin for OptionalOperation
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