1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use bitflags::bitflags;
use parity_scale_codec::{Decode, Encode};

bitflags! {
  /// Permissions for fragments and fragment's bundles.
  #[derive(Encode, Decode, scale_info::TypeInfo)]
  pub struct FragmentPerms: u32 {
    const NONE = 0;
    const EDIT = 1;
    const COPY = 2;
    const TRANSFER = 4;
    const ALL = Self::EDIT.bits | Self::COPY.bits | Self::TRANSFER.bits;
  }
}

#[cfg(test)]
mod tests {
    use super::*;

    struct TestStruct {
        pub _name: String,
        pub permissions: FragmentPerms,
    }

    #[test]
    fn t1() {
        let test_struct = TestStruct {
            _name: "test".to_string(),
            permissions: FragmentPerms::NONE,
        };

        assert_eq!(test_struct.permissions.bits, 0);
    }
}