crdb_core/importance.rs
1bitflags::bitflags! {
2 #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
3 #[derive(Copy, Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
4 pub struct Importance: u8 {
5 const NONE = 0;
6
7 /// Request that the server always send updates to this object/query
8 ///
9 /// If `false`, this request will only be answered once.
10 const SUBSCRIBE = 0b01;
11
12 /// Keep the object/query locally across vacuums
13 ///
14 /// If `false`, the object/query will be dropped after the next vacuum.
15 const LOCK = 0b10;
16 }
17}
18
19impl Importance {
20 pub fn lock(&self) -> bool {
21 self.contains(Importance::LOCK)
22 }
23
24 pub fn subscribe(&self) -> bool {
25 self.contains(Importance::SUBSCRIBE)
26 }
27}