use crate::Error;
use super::Group;
pub struct Groups {
groups: Vec<Group>,
}
impl_collection_field!(Groups, Group, groups);
impl From<Groups> for Vec<Group> {
fn from(groups: Groups) -> Self {
groups.groups
}
}
impl Groups {
pub fn new() -> Result<Self, Error> {
Ok(Self {
groups: crate::sys::new_groups()?,
})
}
impl_new_with_refreshed_list!(Groups);
pub fn refresh(&mut self) {
crate::sys::get_groups(&mut self.groups);
}
}