mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-09-24 13:49:44 +00:00
16 lines
383 B
Rust
16 lines
383 B
Rust
//! # Entities constructor
|
|
//!
|
|
//! This trait simplify the construction of new items
|
|
|
|
pub trait EntitiesConstructor {
|
|
type Item;
|
|
|
|
/// Turn a server item into an API entry
|
|
fn new(i: &Self::Item) -> Self;
|
|
|
|
/// Parse a list of it
|
|
fn for_list(l: &Vec<Self::Item>) -> Vec<Self>
|
|
where Self: std::marker::Sized {
|
|
l.iter().map(Self::new).collect()
|
|
}
|
|
} |