Skip to main content

rustidy_ast/ty/
array.rs

1//! Array type
2
3// Imports
4use {
5	crate::{expr::Expression, token, util::Bracketed},
6	super::Type,
7	rustidy_ast_util::delimited,
8	rustidy_format::{Format, Formattable, WhitespaceFormat},
9	rustidy_parse::Parse,
10	rustidy_print::Print,
11	rustidy_util::Whitespace,
12};
13
14/// `ArrayType`
15#[derive(PartialEq, Eq, Clone, Debug)]
16#[derive(serde::Serialize, serde::Deserialize)]
17#[derive(Parse, Formattable, Format, Print)]
18pub struct ArrayType(#[format(args = delimited::FmtRemove)] Bracketed<ArrayTypeInner>);
19
20#[derive(PartialEq, Eq, Clone, Debug)]
21#[derive(serde::Serialize, serde::Deserialize)]
22#[derive(Parse, Formattable, Format, Print)]
23pub struct ArrayTypeInner {
24	pub ty:   Box<Type>,
25	#[format(prefix_ws = Whitespace::REMOVE)]
26	pub semi: token::Semi,
27	#[format(prefix_ws = Whitespace::SINGLE)]
28	pub expr: Expression,
29}