pub struct PinyinMatchConfig<'a> { /* private fields */ }
Available on crate feature
pinyin
only.Expand description
§Performance
To avoid initialization cost, you should share one data
across all configs by either passing &data
:
use ib_matcher::{matcher::PinyinMatchConfig, pinyin::{PinyinData, PinyinNotation}};
let data = PinyinData::new(PinyinNotation::Ascii);
let config = PinyinMatchConfig::builder(PinyinNotation::Ascii).data(&data).build();
let config2 = PinyinMatchConfig::builder(PinyinNotation::Ascii).data(&data).build();
Or using shallow_clone()
:
use ib_matcher::{matcher::PinyinMatchConfig, pinyin::PinyinNotation};
let config = PinyinMatchConfig::notations(PinyinNotation::Ascii);
let config2 = config.shallow_clone();
Implementations§
Source§impl<'a> PinyinMatchConfig<'a>
impl<'a> PinyinMatchConfig<'a>
Sourcepub fn builder(notations: PinyinNotation) -> PinyinMatchConfigBuilder<'a>
pub fn builder(notations: PinyinNotation) -> PinyinMatchConfigBuilder<'a>
Create an instance of PinyinMatchConfig
using the builder syntax
Source§impl<'a> PinyinMatchConfig<'a>
impl<'a> PinyinMatchConfig<'a>
Sourcepub fn notations(notations: PinyinNotation) -> Self
pub fn notations(notations: PinyinNotation) -> Self
Use PinyinMatchConfigBuilder
for more options.
Sourcepub fn shallow_clone(&'a self) -> Self
pub fn shallow_clone(&'a self) -> Self
See PinyinMatchConfig
.
Trait Implementations§
Source§impl<'a> Clone for PinyinMatchConfig<'a>
impl<'a> Clone for PinyinMatchConfig<'a>
Source§fn clone(&self) -> PinyinMatchConfig<'a>
fn clone(&self) -> PinyinMatchConfig<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<'a> !Freeze for PinyinMatchConfig<'a>
impl<'a> RefUnwindSafe for PinyinMatchConfig<'a>
impl<'a> Send for PinyinMatchConfig<'a>
impl<'a> Sync for PinyinMatchConfig<'a>
impl<'a> Unpin for PinyinMatchConfig<'a>
impl<'a> UnwindSafe for PinyinMatchConfig<'a>
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<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