bucky_objects/objects/
app_group.rs1use crate::objects::*;
2use crate::{RawDecode, RawEncode, RawEncodePurpose};
3
4use std::convert::TryFrom;
5
6#[derive(Clone, Debug, RawEncode, RawDecode)]
7pub struct AppGroupDescContent {}
8
9impl DescContent for AppGroupDescContent {
10 fn obj_type() -> u16 {
11 ObjectTypeCode::AppGroup.into()
12 }
13
14 type OwnerType = Option<ObjectId>;
15 type AreaType = SubDescNone;
16 type AuthorType = SubDescNone;
17 type PublicKeyType = SubDescNone;
18}
19
20#[derive(Clone, Debug, RawEncode, RawDecode)]
21pub struct AppGroupBodyContent {}
22
23impl BodyContent for AppGroupBodyContent {}
24
25pub type AppGroupType = NamedObjType<AppGroupDescContent, AppGroupBodyContent>;
26pub type AppGroupBuilder = NamedObjectBuilder<AppGroupDescContent, AppGroupBodyContent>;
27
28pub type AppGroupDesc = NamedObjectDesc<AppGroupDescContent>;
29pub type AppGroupId = NamedObjectId<AppGroupType>;
30pub type AppGroup = NamedObjectBase<AppGroupType>;
31
32impl AppGroupDesc {
33 pub fn action_id(&self) -> AppGroupId {
34 AppGroupId::try_from(self.calculate_id()).unwrap()
35 }
36}
37
38impl AppGroup {
39 pub fn new() -> AppGroupBuilder {
40 let desc_content = AppGroupDescContent {};
41 let body_content = AppGroupBodyContent {};
42 AppGroupBuilder::new(desc_content, body_content)
43 }
44}
45
46#[cfg(test)]
47mod test {
48 use crate::*;
49 #[test]
52 fn app_group() {
53 let action = AppGroup::new().build();
54
55 let buf = action.to_vec().unwrap();
61 let _obj = AppGroup::clone_from_slice(&buf).unwrap();
62 }
63}