Skip to content

Commit 6055f38

Browse files
committed
syn: add Fields::is_unit convenience method
1 parent bb0b971 commit 6055f38

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

syn/src/data.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ pub enum Fields {
4848
Unnamed(Items<Field>),
4949
}
5050

51+
impl Fields {
52+
pub fn is_unit(&self) -> bool { matches!(self, Fields::Unit) }
53+
}
54+
5155
pub trait Element: Sized {
5256
type Input: Sized;
5357
fn with(input: Self::Input, attr_name: &Ident) -> syn::Result<Self>;

0 commit comments

Comments
 (0)