pub struct FilterPatch {
pub mode: Option<FilterMode>,
/* private fields */
}Expand description
a staged set of filter mutations. all methods accumulate changes without touching
the database. call FilterPatch::apply to commit the entire patch atomically.
obtain an instance by calling any mutation method on FilterControl, or via
FilterPatch::new to start from a blank patch.
Fields§
§mode: Option<FilterMode>if set, replaces the current indexing mode.
Implementations§
Source§impl FilterPatch
impl FilterPatch
Sourcepub fn new(control: &FilterControl) -> Self
pub fn new(control: &FilterControl) -> Self
create a new blank patch associated with the given FilterControl.
Sourcepub fn set_mode(self, mode: FilterMode) -> Self
pub fn set_mode(self, mode: FilterMode) -> Self
set the indexing mode. see FilterControl for mode semantics.
Sourcepub fn set_signals(
self,
signals: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn set_signals( self, signals: impl IntoIterator<Item = impl Into<String>>, ) -> Self
replace the entire signals set. existing signals are removed.
Sourcepub fn append_signals(
self,
signals: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn append_signals( self, signals: impl IntoIterator<Item = impl Into<String>>, ) -> Self
add multiple signals without disturbing existing ones.
Sourcepub fn add_signal(self, signal: impl Into<String>) -> Self
pub fn add_signal(self, signal: impl Into<String>) -> Self
add a single signal. no-op if already present.
Sourcepub fn remove_signal(self, signal: impl Into<String>) -> Self
pub fn remove_signal(self, signal: impl Into<String>) -> Self
remove a single signal. no-op if not present.
Sourcepub fn set_collections(
self,
collections: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn set_collections( self, collections: impl IntoIterator<Item = impl Into<String>>, ) -> Self
replace the entire collections set. pass an empty iterator to store all collections.
Sourcepub fn append_collections(
self,
collections: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn append_collections( self, collections: impl IntoIterator<Item = impl Into<String>>, ) -> Self
add multiple collections without disturbing existing ones.
Sourcepub fn add_collection(self, collection: impl Into<String>) -> Self
pub fn add_collection(self, collection: impl Into<String>) -> Self
add a single collection filter. no-op if already present.
Sourcepub fn remove_collection(self, collection: impl Into<String>) -> Self
pub fn remove_collection(self, collection: impl Into<String>) -> Self
remove a single collection filter. no-op if not present.
Sourcepub fn set_excludes(
self,
excludes: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn set_excludes( self, excludes: impl IntoIterator<Item = impl Into<String>>, ) -> Self
replace the entire excludes set.
Sourcepub fn append_excludes(
self,
excludes: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn append_excludes( self, excludes: impl IntoIterator<Item = impl Into<String>>, ) -> Self
add multiple DIDs to the excludes set without disturbing existing ones.
Sourcepub fn add_exclude(self, did: impl Into<String>) -> Self
pub fn add_exclude(self, did: impl Into<String>) -> Self
add a single DID to the excludes set. no-op if already excluded.
Sourcepub fn remove_exclude(self, did: impl Into<String>) -> Self
pub fn remove_exclude(self, did: impl Into<String>) -> Self
remove a single DID from the excludes set. no-op if not present.
Sourcepub async fn apply(self) -> Result<FilterSnapshot>
pub async fn apply(self) -> Result<FilterSnapshot>
commit the patch atomically to the database and update the in-memory filter.
returns the updated FilterSnapshot.
Auto Trait Implementations§
impl Freeze for FilterPatch
impl !RefUnwindSafe for FilterPatch
impl Send for FilterPatch
impl Sync for FilterPatch
impl Unpin for FilterPatch
impl !UnwindSafe for FilterPatch
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more