natter/src/intermediate/plain_list.rs

31 lines
776 B
Rust
Raw Normal View History

2023-10-27 21:08:58 +00:00
use crate::error::CustomError;
use super::registry::Registry;
2023-10-28 00:12:56 +00:00
use super::IPlainListItem;
2023-10-27 21:08:58 +00:00
#[derive(Debug)]
2023-10-28 00:12:56 +00:00
pub(crate) struct IPlainList {
pub(crate) list_type: organic::types::PlainListType,
pub(crate) children: Vec<IPlainListItem>,
}
2023-10-27 21:08:58 +00:00
impl IPlainList {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
plain_list: &organic::types::PlainList<'parse>,
) -> Result<IPlainList, CustomError> {
2023-10-28 00:12:56 +00:00
let children = {
let mut ret = Vec::new();
for obj in plain_list.children.iter() {
ret.push(IPlainListItem::new(registry, obj).await?);
}
ret
};
Ok(IPlainList {
list_type: plain_list.list_type,
children,
})
2023-10-27 21:08:58 +00:00
}
}