Skip to main content

rustidy_ast/expr/without_block/
break_.rs

1//! Break
2
3// Imports
4use {
5	crate::{expr::Expression, lifetime::LifetimeOrLabel, token},
6	rustidy_format::{Format, Formattable, WhitespaceFormat},
7	rustidy_parse::{Parse, ParserTag},
8	rustidy_print::Print,
9	rustidy_util::Whitespace,
10};
11
12/// `BreakExpression`
13#[derive(PartialEq, Eq, Clone, Debug)]
14#[derive(serde::Serialize, serde::Deserialize)]
15#[derive(Parse, Formattable, Format, Print)]
16pub struct BreakExpression {
17	pub continue_: token::Break,
18	#[format(prefix_ws = Whitespace::SINGLE)]
19	pub label:     Option<LifetimeOrLabel>,
20	// TODO: Do we need to be parse-recursive here?
21	#[parse(skip_if_tag = ParserTag::SkipOptionalTrailingBlockExpression)]
22	#[format(prefix_ws = Whitespace::SINGLE)]
23	pub expr:      Option<Expression>,
24}