2023-10-29 17:29:16 -04:00
|
|
|
use super::macros::intermediate;
|
2023-10-27 17:08:58 -04:00
|
|
|
use super::registry::Registry;
|
2023-10-27 20:12:56 -04:00
|
|
|
use super::IPlainListItem;
|
2023-10-29 17:29:16 -04:00
|
|
|
use crate::error::CustomError;
|
2023-10-27 17:08:58 -04:00
|
|
|
|
2023-10-29 15:36:15 -04:00
|
|
|
#[derive(Debug, Clone)]
|
2023-10-27 20:12:56 -04:00
|
|
|
pub(crate) struct IPlainList {
|
|
|
|
pub(crate) list_type: organic::types::PlainListType,
|
|
|
|
pub(crate) children: Vec<IPlainListItem>,
|
|
|
|
}
|
2023-10-27 17:08:58 -04:00
|
|
|
|
2023-10-29 17:29:16 -04:00
|
|
|
intermediate!(IPlainList, PlainList, |registry, original| async {
|
|
|
|
let children = {
|
|
|
|
let mut ret = Vec::new();
|
|
|
|
for obj in original.children.iter() {
|
|
|
|
ret.push(IPlainListItem::new(registry, obj).await?);
|
|
|
|
}
|
|
|
|
ret
|
|
|
|
};
|
2023-10-27 20:12:56 -04:00
|
|
|
|
2023-10-29 17:29:16 -04:00
|
|
|
Ok(IPlainList {
|
|
|
|
list_type: original.list_type,
|
|
|
|
children,
|
|
|
|
})
|
|
|
|
});
|