pub enum GateMode {
Global,
FileSpecific {
guid: Arc<str>,
},
FileGroup {
guids: Vec<Arc<str>>,
},
}Expand description
The scope of a gate - determines which files it applies to.
Gates can be:
- Global: Applies to all files
- FileSpecific: Applies only to a single file (identified by GUID)
- FileGroup: Applies to a specific set of files
This allows gates to be shared across multiple files or restricted to specific datasets.
§Example
use flow_gates::GateMode;
// Global gate (applies to all files)
let global = GateMode::Global;
assert!(global.applies_to("any-file-guid"));
// File-specific gate
let specific = GateMode::FileSpecific { guid: "file-123".into() };
assert!(specific.applies_to("file-123"));
assert!(!specific.applies_to("file-456"));
// File group gate
let group = GateMode::FileGroup { guids: vec!["file-1".into(), "file-2".into()] };
assert!(group.applies_to("file-1"));
assert!(group.applies_to("file-2"));
assert!(!group.applies_to("file-3"));Variants§
Global
Gate applies to all files
FileSpecific
Gate applies only to a specific file
FileGroup
Gate applies to a group of files
Implementations§
Source§impl GateMode
Helper functions for managing gate types
impl GateMode
Helper functions for managing gate types
Sourcepub fn file_specific(guid: impl Into<Arc<str>>) -> Self
pub fn file_specific(guid: impl Into<Arc<str>>) -> Self
Create a file-specific type
Sourcepub fn add_file(&mut self, guid: impl Into<Arc<str>>)
pub fn add_file(&mut self, guid: impl Into<Arc<str>>)
Add a file to a group type (no-op for Global or FileSpecific)
Sourcepub fn remove_file(&mut self, guid: &str)
pub fn remove_file(&mut self, guid: &str)
Remove a file from a group type (no-op for Global or FileSpecific)
Sourcepub fn file_guids(&self) -> Option<Vec<&str>>
pub fn file_guids(&self) -> Option<Vec<&str>>
Get the list of file GUIDs this type applies to (None for Global)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for GateMode
impl<'de> Deserialize<'de> for GateMode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for GateMode
impl StructuralPartialEq for GateMode
Auto Trait Implementations§
impl Freeze for GateMode
impl RefUnwindSafe for GateMode
impl Send for GateMode
impl Sync for GateMode
impl Unpin for GateMode
impl UnwindSafe for GateMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more