1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use syn;

use crate::section::Section;

#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SectionItem {
    Sep(Section),
    Stmt(syn::Stmt),
}

impl SectionItem {
    pub fn is_stmt(&self) -> bool {
        match self {
            Self::Stmt(_) => true,
            _ => false,
        }
    }

    pub fn stmt(&self) -> Option<syn::Stmt> {
        match self {
            Self::Stmt(inner) => Some(inner.clone()),
            _ => None,
        }
    }
}