vue_sfc/ast/
section.rs

1use std::fmt::Display;
2
3use crate::{Block, Raw};
4
5/// A Vue SFC section.
6#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
7pub enum Section<'a> {
8    /// See [`Raw`];
9    Raw(Raw<'a>),
10    /// See [`Block`].
11    Block(Block<'a>),
12}
13
14impl Display for Section<'_> {
15    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16        match self {
17            Self::Raw(content) => content.fmt(f),
18            Self::Block(block) => block.fmt(f),
19        }
20    }
21}