pub struct GlobalSearch { /* private fields */ }Expand description
Configuration and results for a global search operation.
This struct holds all parameters needed to perform a search across a pack, as well as the results from the most recent search operation.
§Example
let mut search = GlobalSearch::default();
search.set_pattern("cavalry".to_string());
search.set_case_sensitive(false);
search.search(&mut pack, &schema, &dependencies);Implementations§
Source§impl GlobalSearch
impl GlobalSearch
Sourcepub fn replace_text(&self) -> &String
pub fn replace_text(&self) -> &String
Text to use for replacements.
This is always a literal string - regex capture groups are not supported in the replacement text.
Sourcepub fn case_sensitive(&self) -> &bool
pub fn case_sensitive(&self) -> &bool
Whether the search should be case-sensitive.
When false, “Cavalry” will match “cavalry”, “CAVALRY”, etc.
Sourcepub fn use_regex(&self) -> &bool
pub fn use_regex(&self) -> &bool
Whether to interpret the pattern as a regular expression.
When true, the pattern is compiled as a regex. If compilation fails,
the search falls back to literal pattern matching.
Sourcepub fn sources(&self) -> &Vec<SearchSource>
pub fn sources(&self) -> &Vec<SearchSource>
Which data sources to include in the search.
Source§impl GlobalSearch
impl GlobalSearch
Sourcepub fn pattern_mut(&mut self) -> &mut String
pub fn pattern_mut(&mut self) -> &mut String
The text pattern or regex to search for.
Sourcepub fn replace_text_mut(&mut self) -> &mut String
pub fn replace_text_mut(&mut self) -> &mut String
Text to use for replacements.
This is always a literal string - regex capture groups are not supported in the replacement text.
Sourcepub fn case_sensitive_mut(&mut self) -> &mut bool
pub fn case_sensitive_mut(&mut self) -> &mut bool
Whether the search should be case-sensitive.
When false, “Cavalry” will match “cavalry”, “CAVALRY”, etc.
Sourcepub fn use_regex_mut(&mut self) -> &mut bool
pub fn use_regex_mut(&mut self) -> &mut bool
Whether to interpret the pattern as a regular expression.
When true, the pattern is compiled as a regex. If compilation fails,
the search falls back to literal pattern matching.
Sourcepub fn sources_mut(&mut self) -> &mut Vec<SearchSource>
pub fn sources_mut(&mut self) -> &mut Vec<SearchSource>
Which data sources to include in the search.
Sourcepub fn search_on_mut(&mut self) -> &mut SearchOn
pub fn search_on_mut(&mut self) -> &mut SearchOn
Which file types to search within.
Sourcepub fn matches_mut(&mut self) -> &mut Matches
pub fn matches_mut(&mut self) -> &mut Matches
Results from the most recent search operation.
Sourcepub fn game_key_mut(&mut self) -> &mut String
pub fn game_key_mut(&mut self) -> &mut String
Game key for the files being searched.
Required for decoding certain game-specific file formats during search.
Source§impl GlobalSearch
impl GlobalSearch
Sourcepub fn set_pattern(&mut self, val: String) -> &mut Self
pub fn set_pattern(&mut self, val: String) -> &mut Self
The text pattern or regex to search for.
Sourcepub fn set_replace_text(&mut self, val: String) -> &mut Self
pub fn set_replace_text(&mut self, val: String) -> &mut Self
Text to use for replacements.
This is always a literal string - regex capture groups are not supported in the replacement text.
Sourcepub fn set_case_sensitive(&mut self, val: bool) -> &mut Self
pub fn set_case_sensitive(&mut self, val: bool) -> &mut Self
Whether the search should be case-sensitive.
When false, “Cavalry” will match “cavalry”, “CAVALRY”, etc.
Sourcepub fn set_use_regex(&mut self, val: bool) -> &mut Self
pub fn set_use_regex(&mut self, val: bool) -> &mut Self
Whether to interpret the pattern as a regular expression.
When true, the pattern is compiled as a regex. If compilation fails,
the search falls back to literal pattern matching.
Sourcepub fn set_sources(&mut self, val: Vec<SearchSource>) -> &mut Self
pub fn set_sources(&mut self, val: Vec<SearchSource>) -> &mut Self
Which data sources to include in the search.
Sourcepub fn set_search_on(&mut self, val: SearchOn) -> &mut Self
pub fn set_search_on(&mut self, val: SearchOn) -> &mut Self
Which file types to search within.
Sourcepub fn set_matches(&mut self, val: Matches) -> &mut Self
pub fn set_matches(&mut self, val: Matches) -> &mut Self
Results from the most recent search operation.
Sourcepub fn set_game_key(&mut self, val: String) -> &mut Self
pub fn set_game_key(&mut self, val: String) -> &mut Self
Game key for the files being searched.
Required for decoding certain game-specific file formats during search.
Source§impl GlobalSearch
impl GlobalSearch
Sourcepub fn search(
&mut self,
game_info: &GameInfo,
schema: &Schema,
packs: &mut BTreeMap<String, Pack>,
dependencies: &mut Dependencies,
update_paths: &[ContainerPath],
)
pub fn search( &mut self, game_info: &GameInfo, schema: &Schema, packs: &mut BTreeMap<String, Pack>, dependencies: &mut Dependencies, update_paths: &[ContainerPath], )
This function performs a search over the parts of the provided Packs, storing his results.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
This function clears the Global Search result’s data, and reset the UI for it.
Sourcepub fn replace_possible(&self, matches: &[MatchHolder]) -> Result<()>
pub fn replace_possible(&self, matches: &[MatchHolder]) -> Result<()>
This function checks if it’s possible to replace the provided matches.
Sourcepub fn replace(
&mut self,
game_info: &GameInfo,
schema: &Schema,
packs: &mut BTreeMap<String, Pack>,
dependencies: &mut Dependencies,
matches: &[MatchHolder],
) -> Result<Vec<ContainerPath>>
pub fn replace( &mut self, game_info: &GameInfo, schema: &Schema, packs: &mut BTreeMap<String, Pack>, dependencies: &mut Dependencies, matches: &[MatchHolder], ) -> Result<Vec<ContainerPath>>
This function performs a replace operation over the provided matches.
NOTE: Schema matches are always ignored.
pub fn replace_all( &mut self, game_info: &GameInfo, schema: &Schema, packs: &mut BTreeMap<String, Pack>, dependencies: &mut Dependencies, ) -> Result<Vec<ContainerPath>>
Trait Implementations§
Source§impl Clone for GlobalSearch
impl Clone for GlobalSearch
Source§fn clone(&self) -> GlobalSearch
fn clone(&self) -> GlobalSearch
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GlobalSearch
impl Debug for GlobalSearch
Source§impl Default for GlobalSearch
impl Default for GlobalSearch
Source§fn default() -> GlobalSearch
fn default() -> GlobalSearch
Source§impl<'de> Deserialize<'de> for GlobalSearch
impl<'de> Deserialize<'de> for GlobalSearch
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>,
Auto Trait Implementations§
impl Freeze for GlobalSearch
impl RefUnwindSafe for GlobalSearch
impl Send for GlobalSearch
impl Sync for GlobalSearch
impl Unpin for GlobalSearch
impl UnsafeUnpin for GlobalSearch
impl UnwindSafe for GlobalSearch
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.