pub enum AssocOp {
Show 23 variants
Add,
Subtract,
Multiply,
Divide,
Modulus,
LAnd,
LOr,
BitXor,
BitAnd,
BitOr,
ShiftLeft,
ShiftRight,
Equal,
Less,
LessEqual,
NotEqual,
Greater,
GreaterEqual,
Assign,
AssignOp(BinOpToken),
As,
DotDot,
DotDotEq,
}
Expand description
Associative operator with precedence.
This is the enum which specifies operator precedence and fixity to the parser.
Variants§
Add
+
Subtract
-
Multiply
*
Divide
/
Modulus
%
LAnd
&&
LOr
||
BitXor
^
BitAnd
&
BitOr
|
ShiftLeft
<<
ShiftRight
>>
Equal
==
Less
<
LessEqual
<=
NotEqual
!=
Greater
>
GreaterEqual
>=
Assign
=
AssignOp(BinOpToken)
?=
where ? is one of the BinOpToken
As
as
DotDot
..
range
DotDotEq
..=
range
Implementations§
source§impl AssocOp
impl AssocOp
sourcepub fn from_token(t: &Token) -> Option<AssocOp>
pub fn from_token(t: &Token) -> Option<AssocOp>
Creates a new AssocOP from a token
sourcepub fn from_ast_binop(op: BinOpKind) -> Self
pub fn from_ast_binop(op: BinOpKind) -> Self
Creates a new AssocOp from ast::BinOpKind.
sourcepub fn precedence(&self) -> usize
pub fn precedence(&self) -> usize
Gets the precedence of this operator
pub fn is_comparison(&self) -> bool
pub fn is_assign_like(&self) -> bool
pub fn to_ast_binop(&self) -> Option<BinOpKind>
sourcepub fn can_continue_expr_unambiguously(&self) -> bool
pub fn can_continue_expr_unambiguously(&self) -> bool
This operator could be used to follow a block unambiguously.
This is used for error recovery at the moment, providing a suggestion to wrap blocks with parentheses while having a high degree of confidence on the correctness of the suggestion.
Trait Implementations§
source§impl PartialEq for AssocOp
impl PartialEq for AssocOp
impl Copy for AssocOp
impl StructuralPartialEq for AssocOp
Auto Trait Implementations§
impl DynSend for AssocOp
impl DynSync for AssocOp
impl Freeze for AssocOp
impl RefUnwindSafe for AssocOp
impl Send for AssocOp
impl Sync for AssocOp
impl Unpin for AssocOp
impl UnwindSafe for AssocOp
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte
Size for each variant:
Add
: 0 bytesSubtract
: 0 bytesMultiply
: 0 bytesDivide
: 0 bytesModulus
: 0 bytesLAnd
: 0 bytesLOr
: 0 bytesBitXor
: 0 bytesBitAnd
: 0 bytesBitOr
: 0 bytesShiftLeft
: 0 bytesShiftRight
: 0 bytesEqual
: 0 bytesLess
: 0 bytesLessEqual
: 0 bytesNotEqual
: 0 bytesGreater
: 0 bytesGreaterEqual
: 0 bytesAssign
: 0 bytesAssignOp
: 1 byteAs
: 0 bytesDotDot
: 0 bytesDotDotEq
: 0 bytes