lib/grammar/ast/action/
fileinto.rs1use pest::iterators::Pair;
2use serde::Serialize;
3
4use crate::grammar::ast::literal::{Literal, LiteralTypes};
5use crate::grammar::parser::Rule;
6
7#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
8#[serde(tag = "kind")]
9pub struct ActionFileinto {
10 mailbox: Option<LiteralTypes>,
11}
12
13impl Default for ActionFileinto {
14 fn default() -> Self {
15 Self { mailbox: None }
16 }
17}
18
19impl<'r> From<Pair<'r, Rule>> for ActionFileinto {
20 fn from(pair: Pair<'r, Rule>) -> Self {
21 let mailbox = Some(Literal::from(pair.into_inner().next().unwrap()).inner());
22
23 Self {
24 mailbox,
25 ..Self::default()
26 }
27 }
28}