pub struct ReplaceOptions {
pub find: FindOptions,
pub format_policy: ReplaceFormatPolicy,
}Expand description
Options for a replace: how to find the text, and what the replacement wears where it overwrites formatted prose.
The format policy is deliberately not on FindOptions — it means nothing to a
find, and a search option that silently only applies to half the calls that take it
is how dead toggles are born.
Fields§
§find: FindOptions§format_policy: ReplaceFormatPolicyDefaults to ReplaceFormatPolicy::InheritPreceding — the behaviour that has
always shipped, which drops the formatting under the replaced range. Choose
another policy when the range may be formatted and losing that would be wrong
(a character rename landing on a partly-bold name).
Implementations§
Source§impl ReplaceOptions
impl ReplaceOptions
Sourcepub fn new(find: FindOptions) -> Self
pub fn new(find: FindOptions) -> Self
A replace that finds the text exactly as find describes and keeps the default
(historical) format policy.
pub fn with_format_policy(self, policy: ReplaceFormatPolicy) -> Self
Trait Implementations§
Source§impl Clone for ReplaceOptions
impl Clone for ReplaceOptions
Source§fn clone(&self) -> ReplaceOptions
fn clone(&self) -> ReplaceOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReplaceOptions
impl Debug for ReplaceOptions
Source§impl Default for ReplaceOptions
impl Default for ReplaceOptions
Source§fn default() -> ReplaceOptions
fn default() -> ReplaceOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ReplaceOptions
impl RefUnwindSafe for ReplaceOptions
impl Send for ReplaceOptions
impl Sync for ReplaceOptions
impl Unpin for ReplaceOptions
impl UnsafeUnpin for ReplaceOptions
impl UnwindSafe for ReplaceOptions
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