Skip to main content

Replaceable

Trait Replaceable 

Source
pub trait Replaceable: Searchable {
    // Required method
    fn replace(
        &mut self,
        pattern: &str,
        replace_pattern: &str,
        case_sensitive: bool,
        matching_mode: &MatchingMode,
        search_matches: &Self::SearchMatches,
    ) -> bool;
}
Expand description

Trait for searchable types that also support replacement.

Extends Searchable to allow replacing matched text with new content. Not all searchable types support replacement (e.g., read-only or binary files).

Required Methods§

Source

fn replace( &mut self, pattern: &str, replace_pattern: &str, case_sensitive: bool, matching_mode: &MatchingMode, search_matches: &Self::SearchMatches, ) -> bool

Replaces matched text with the replacement pattern.

§Arguments
  • pattern - The original search pattern
  • replace_pattern - The text to replace matches with (literal, no regex)
  • case_sensitive - Whether matching should be case-sensitive
  • matching_mode - How to interpret the search pattern
  • search_matches - Previously found matches to replace
§Returns

true if any replacements were made, false if no changes occurred.

§Note

Replacements may fail if:

  • The search matches are outdated (file was modified since search)
  • The replacement text is identical to the matched text

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Replaceable for AnimFragmentBattle

Source§

fn replace( &mut self, pattern: &str, replace_pattern: &str, case_sensitive: bool, matching_mode: &MatchingMode, search_matches: &AnimFragmentBattleMatches, ) -> bool

Source§

impl Replaceable for Atlas

Source§

fn replace( &mut self, pattern: &str, replace_pattern: &str, case_sensitive: bool, matching_mode: &MatchingMode, search_matches: &AtlasMatches, ) -> bool

Source§

impl Replaceable for DB

Source§

fn replace( &mut self, pattern: &str, replace_pattern: &str, case_sensitive: bool, matching_mode: &MatchingMode, search_matches: &TableMatches, ) -> bool

Source§

impl Replaceable for Loc

Source§

fn replace( &mut self, pattern: &str, replace_pattern: &str, case_sensitive: bool, matching_mode: &MatchingMode, search_matches: &TableMatches, ) -> bool

Source§

impl Replaceable for PortraitSettings

Source§

fn replace( &mut self, pattern: &str, replace_pattern: &str, case_sensitive: bool, matching_mode: &MatchingMode, search_matches: &PortraitSettingsMatches, ) -> bool

Source§

impl Replaceable for RigidModel

Source§

fn replace( &mut self, pattern: &str, replace_pattern: &str, case_sensitive: bool, matching_mode: &MatchingMode, search_matches: &RigidModelMatches, ) -> bool

Source§

impl Replaceable for Text

Source§

fn replace( &mut self, pattern: &str, replace_pattern: &str, case_sensitive: bool, matching_mode: &MatchingMode, search_matches: &TextMatches, ) -> bool

Source§

impl Replaceable for UnitVariant

Source§

fn replace( &mut self, pattern: &str, replace_pattern: &str, case_sensitive: bool, matching_mode: &MatchingMode, search_matches: &UnitVariantMatches, ) -> bool

Source§

impl Replaceable for Unknown

Source§

fn replace( &mut self, _pattern: &str, replace_pattern: &str, _case_sensitive: bool, _matching_mode: &MatchingMode, search_matches: &UnknownMatches, ) -> bool

Implementors§