pub enum Mode {
Module,
Expression,
ParenthesizedExpression,
Ipython,
}Expand description
Control in the different modes by which a source file can be parsed.
The mode argument specifies in what way code must be parsed.
Variants§
Module
The code consists of a sequence of statements.
Expression
The code consists of a single expression.
ParenthesizedExpression
The code consists of a single expression and is parsed as if it is parenthesized. The parentheses themselves aren’t required. This allows for having valid multiline expression without the need of parentheses and is specifically useful for parsing string annotations.
Ipython
The code consists of a sequence of statements which can include the escape commands that are part of IPython syntax.
§Supported escape commands:
- Magic command system which is limited to line magics and can start
with
?or??. - Dynamic object information which can start with
?or??. - System shell access which can start with
!or!!. - Automatic parentheses and quotes which can start with
/,;, or,.
Trait Implementations§
Source§impl From<Mode> for ParseOptions
impl From<Mode> for ParseOptions
impl Copy for Mode
impl Eq for Mode
impl StructuralPartialEq for Mode
Auto Trait Implementations§
impl Freeze for Mode
impl RefUnwindSafe for Mode
impl Send for Mode
impl Sync for Mode
impl Unpin for Mode
impl UnsafeUnpin for Mode
impl UnwindSafe for Mode
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