Struct analiticcl::VariantModel
source · pub struct VariantModel {Show 16 fields
pub decoder: VocabDecoder,
pub encoder: VocabEncoder,
pub alphabet: Alphabet,
pub index: AnaIndex,
pub sortedindex: BTreeMap<u16, Vec<AnaValue>>,
pub ngrams: HashMap<NGram, u32>,
pub freq_sum: Vec<usize>,
pub have_freq: bool,
pub have_lm: bool,
pub context_rules: Vec<ContextRule>,
pub tags: Vec<String>,
pub weights: Weights,
pub lexicons: Vec<String>,
pub confusables: Vec<Confusable>,
pub confusables_before_pruning: bool,
pub debug: u8,
}
Expand description
The VariantModel is the most high-level model of analiticcl, it holds all data required for variant matching.
Fields§
§decoder: VocabDecoder
Maps Vocabulary IDs to their textual strings and other related properties
encoder: VocabEncoder
Map strings to vocabulary IDs
alphabet: Alphabet
Defines the alphabet used for the variant model
index: AnaIndex
The main index, mapping anagrams to instances
sortedindex: BTreeMap<u16, Vec<AnaValue>>
A secondary sorted index indices of the outer vector correspond to the length of an anagram (in chars) - 1 Inner vector is always sorted
ngrams: HashMap<NGram, u32>
Ngrams for simple context-sensitive language modelling when finding the most probable sequence of variants
freq_sum: Vec<usize>
Total frequency, index corresponds to n-1 size, so this holds the total count for unigrams, bigrams, etc.
have_freq: bool
Do we have frequency information for variant matching?
have_lm: bool
Do we have an LM?
context_rules: Vec<ContextRule>
Context rules
Tags used by the context rules
weights: Weights
Weights used in distance scoring
lexicons: Vec<String>
Stores the names of the loaded lexicons, they will be referenced by index from individual items for provenance reasons
confusables: Vec<Confusable>
Holds weighted confusable recipes that can be used in scoring and ranking
confusables_before_pruning: bool
Process confusables before pruning by max_matches
debug: u8
Implementations§
source§impl VariantModel
impl VariantModel
sourcepub fn new(alphabet_file: &str, weights: Weights, debug: u8) -> VariantModel
pub fn new(alphabet_file: &str, weights: Weights, debug: u8) -> VariantModel
Instantiate a new variant model
sourcepub fn new_with_alphabet(
alphabet: Alphabet,
weights: Weights,
debug: u8
) -> VariantModel
pub fn new_with_alphabet( alphabet: Alphabet, weights: Weights, debug: u8 ) -> VariantModel
Instantiate a new variant model, explicitly passing an alphabet rather than loading one from file.
sourcepub fn set_confusables_before_pruning(&mut self)
pub fn set_confusables_before_pruning(&mut self)
Configure the model to match against known confusables prior to pruning on maximum weight. This may lead to better results but may have a significant performance impact.
sourcepub fn alphabet_size(&self) -> CharIndexType
pub fn alphabet_size(&self) -> CharIndexType
Returns the size of the alphabet, this is typically +1 longer than the actual alphabet file as it includes the UNKNOWN symbol.
sourcepub fn get_or_create_index<'a, 'b>(
&'a mut self,
anahash: &'b AnaValue
) -> &'a mut AnaIndexNode
pub fn get_or_create_index<'a, 'b>( &'a mut self, anahash: &'b AnaValue ) -> &'a mut AnaIndexNode
Get an item from the index or insert it if it doesn’t exist yet
sourcepub fn build(&mut self)
pub fn build(&mut self)
Build the anagram index (and secondary index) so the model is ready for variant matching
sourcepub fn contains_key(&self, key: &AnaValue) -> bool
pub fn contains_key(&self, key: &AnaValue) -> bool
Tests if the anagram value exists in the index
sourcepub fn get_anagram_instances(&self, text: &str) -> Vec<&VocabValue>
pub fn get_anagram_instances(&self, text: &str) -> Vec<&VocabValue>
Get all anagram instances for a specific entry
sourcepub fn get(&self, text: &str) -> Option<&VocabValue>
pub fn get(&self, text: &str) -> Option<&VocabValue>
Get an exact item in the lexicon (if it exists)
sourcepub fn get_vocab(&self, vocab_id: VocabId) -> Option<&VocabValue>
pub fn get_vocab(&self, vocab_id: VocabId) -> Option<&VocabValue>
Resolves a vocabulary ID
Decomposes and decodes and anagram value into the characters that make it up. Mostly intended for debugging purposes.
sourcepub fn read_alphabet(&mut self, filename: &str) -> Result<(), Error>
pub fn read_alphabet(&mut self, filename: &str) -> Result<(), Error>
Read the alphabet from a TSV file The file contains one alphabet entry per line, but may consist of multiple tab-separated alphabet entries on that line, which will be treated as the identical. The alphabet is not limited to single characters but may consist of longer string, a greedy matching approach will be used so order matters (but only for this)
sourcepub fn read_confusablelist(&mut self, filename: &str) -> Result<(), Error>
pub fn read_confusablelist(&mut self, filename: &str) -> Result<(), Error>
Read a confusiblelist from a TSV file Contains edit scripts in the first columned (formatted in sesdiff style) and optionally a weight in the second column. favourable confusables have a weight > 1.0, unfavourable ones are < 1.0 (penalties) Weight values should be relatively close to 1.0 as they are applied to the entire score
sourcepub fn add_to_confusables(
&mut self,
editscript: &str,
weight: f64
) -> Result<(), Error>
pub fn add_to_confusables( &mut self, editscript: &str, weight: f64 ) -> Result<(), Error>
Add a confusable
sourcepub fn add_variant(
&mut self,
ref_id: VocabId,
variant: &str,
score: f64,
freq: Option<u32>,
params: &VocabParams
) -> bool
pub fn add_variant( &mut self, ref_id: VocabId, variant: &str, score: f64, freq: Option<u32>, params: &VocabParams ) -> bool
Add a (weighted) variant to the model, referring to a reference that already exists in the model. Variants will be added to the lexicon automatically when necessary. Set VocabType::TRANSPARENT if you want variants to only be used as an intermediate towards items that have already been added previously through a more authoritative lexicon.
sourcepub fn add_variant_by_id(
&mut self,
ref_id: VocabId,
variantid: VocabId,
score: f64
) -> bool
pub fn add_variant_by_id( &mut self, ref_id: VocabId, variantid: VocabId, score: f64 ) -> bool
Add a (weighted) variant to the model, referring to a reference that already exists in the model. Variants will be added to the lexicon automatically when necessary. Set VocabType::TRANSPARENT if you want variants to only be used as an intermediate towards items that have already been added previously through a more authoritative lexicon.
sourcepub fn read_vocabulary(
&mut self,
filename: &str,
params: &VocabParams
) -> Result<(), Error>
pub fn read_vocabulary( &mut self, filename: &str, params: &VocabParams ) -> Result<(), Error>
Read vocabulary (a lexicon or corpus-derived lexicon) from a TSV file May contain frequency information The parameters define what value can be read from what column
pub fn read_contextrules(&mut self, filename: &str) -> Result<(), Error>
pub fn add_contextrule( &mut self, pattern: &str, score: f32, tag: Vec<&str>, tagoffset: Vec<&str> ) -> Result<(), Error>
sourcepub fn read_variants(
&mut self,
filename: &str,
params: Option<&VocabParams>,
transparent: bool
) -> Result<(), Error>
pub fn read_variants( &mut self, filename: &str, params: Option<&VocabParams>, transparent: bool ) -> Result<(), Error>
Read a weighted variant list from a TSV file. Contains a canonical/reference form in the first column, and variants with score (two columns) in the following columns. May also contain frequency information (auto detected), in which case the first column has the canonical/reference form, the second column the frequency, and all further columns hold variants, their score and their frequency (three columns). Consumes much more memory than equally weighted variants.
sourcepub fn add_to_vocabulary(
&mut self,
text: &str,
frequency: Option<u32>,
params: &VocabParams
) -> VocabId
pub fn add_to_vocabulary( &mut self, text: &str, frequency: Option<u32>, params: &VocabParams ) -> VocabId
Adds an entry in the vocabulary
sourcepub fn find_variants(
&self,
input: &str,
params: &SearchParameters
) -> Vec<VariantResult>
pub fn find_variants( &self, input: &str, params: &SearchParameters ) -> Vec<VariantResult>
Find variants in the vocabulary for a given string (in its totality), returns a vector of vocabulary ID and score pairs
Returns a vector of three-tuples (VocabId, distance_score, freq_score)
The resulting vocabulary Ids can be resolved through get_vocab()
sourcepub fn learn_variants<'a, I>(
&mut self,
input: I,
params: &SearchParameters,
strict: bool,
auto_build: bool
) -> usizewhere
I: IntoParallelIterator<Item = &'a String> + IntoIterator<Item = &'a String>,
pub fn learn_variants<'a, I>( &mut self, input: I, params: &SearchParameters, strict: bool, auto_build: bool ) -> usizewhere I: IntoParallelIterator<Item = &'a String> + IntoIterator<Item = &'a String>,
Processes input and finds variants (like [find_variants()
]), but all variants that are found (which meet
the set thresholds) will be stored in the model rather than returned. Unlike find_variants()
, this is
invoked with an iterator over multiple inputs and returns no output by itself. It
will automatically apply parallellisation.
sourcepub fn rescore_confusables(&self, results: &mut Vec<VariantResult>, input: &str)
pub fn rescore_confusables(&self, results: &mut Vec<VariantResult>, input: &str)
Rescore results according to confusables
sourcepub fn rank_results(&self, results: &mut Vec<VariantResult>, freq_weight: f32)
pub fn rank_results(&self, results: &mut Vec<VariantResult>, freq_weight: f32)
Sorts a result vector of (VocabId, distance_score, freq_score) in decreasing order (best result first)
sourcepub fn expand_variants(&self, results: Vec<VariantResult>) -> Vec<VariantResult>
pub fn expand_variants(&self, results: Vec<VariantResult>) -> Vec<VariantResult>
Expand variants, adding all references for variants In case variants are ‘transparent’, only the references will be retained as results. The results list does not need to be sorted yet. This function may yield duplicates. For performance, call this only when you know there are variants that may be expanded.
sourcepub fn compute_confusable_weight(&self, input: &str, candidate: VocabId) -> f64
pub fn compute_confusable_weight(&self, input: &str, candidate: VocabId) -> f64
compute weight over known confusables Should return 1.0 when there are no known confusables < 1.0 when there are unfavourable confusables
1.0 when there are favourable confusables
sourcepub fn add_to_reverse_index(
&self,
reverseindex: &mut ReverseIndex,
input: &str,
matched_vocab_id: VocabId,
score: f64
)
pub fn add_to_reverse_index( &self, reverseindex: &mut ReverseIndex, input: &str, matched_vocab_id: VocabId, score: f64 )
Adds the input item to the reverse index, as instantiation of the given vocabulary id
sourcepub fn find_all_matches<'a>(
&self,
text: &'a str,
params: &SearchParameters
) -> Vec<Match<'a>>
pub fn find_all_matches<'a>( &self, text: &'a str, params: &SearchParameters ) -> Vec<Match<'a>>
Searches a text and returns all highest-ranking variants found in the text
sourcepub fn test_context_rules<'a>(
&self,
sequence: &Sequence
) -> (f64, Vec<Vec<PatternMatchResult>>)
pub fn test_context_rules<'a>( &self, sequence: &Sequence ) -> (f64, Vec<Vec<PatternMatchResult>>)
Favours or penalizes certain combinations of lexicon matches. matching words X and Y respectively with lexicons A and B might be favoured over other combinations. This returns either a bonus or penalty (number slightly above/below 1.0) score/ for the sequence as a whole.
sourcepub fn lm_score<'a>(
&self,
sequence: &Sequence,
boundaries: &[Match<'a>]
) -> (f32, f64)
pub fn lm_score<'a>( &self, sequence: &Sequence, boundaries: &[Match<'a>] ) -> (f32, f64)
Computes the logprob and perplexity for a given sequence as produced in most_likely_sequence()
sourcepub fn lm_score_tokens<'a>(&self, tokens: &Vec<Option<VocabId>>) -> (f32, f64)
pub fn lm_score_tokens<'a>(&self, tokens: &Vec<Option<VocabId>>) -> (f32, f64)
Computes the logprob and perplexity for a given sequence of tokens. The tokens are either in the vocabulary or are None if out-of-vocabulary.
sourcepub fn match_to_str<'a>(&'a self, m: &Match<'a>) -> &'a str
pub fn match_to_str<'a>(&'a self, m: &Match<'a>) -> &'a str
Gives the text representation for this match, always uses the solution (if any) and falls back to the input text only when no solution was found.
sourcepub fn match_to_vocabvalue<'a>(&'a self, m: &Match<'a>) -> Option<&'a VocabValue>
pub fn match_to_vocabvalue<'a>(&'a self, m: &Match<'a>) -> Option<&'a VocabValue>
Gives the vocabitem for this match, always uses the solution (if any) and falls back to the input text only when no solution was found.
sourcepub fn ngram_to_str(&self, ngram: &NGram) -> String
pub fn ngram_to_str(&self, ngram: &NGram) -> String
Turns the ngram into a tokenised string; the tokens in the ngram will be separated by a space.
Auto Trait Implementations§
impl RefUnwindSafe for VariantModel
impl Send for VariantModel
impl Sync for VariantModel
impl Unpin for VariantModel
impl UnwindSafe for VariantModel
Blanket Implementations§
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,
self
, then passes self.as_mut()
into the pipe
function.§impl<T> Pipe for T
impl<T> Pipe for T
§impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
§impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
§impl<T> PipeDeref for T
impl<T> PipeDeref for T
§impl<T> PipeRef for T
impl<T> PipeRef for T
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
§fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§impl<T> Tap for T
impl<T> Tap for T
§fn tap<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Selfwhere F: FnOnce(&Self) -> R,
§fn tap_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Selfwhere F: FnOnce(&Self) -> R,
tap
in debug builds, and does nothing in release builds.§fn tap_mut<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Selfwhere F: FnOnce(&mut Self) -> R,
§fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere F: FnOnce(&mut Self) -> R,
tap_mut
in debug builds, and does nothing in release builds.§impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
impl<T, U> TapAsRef<U> for Twhere U: ?Sized,
§fn tap_ref<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref<F, R>(self, func: F) -> Selfwhere Self: AsRef<T>, F: FnOnce(&T) -> R,
§fn tap_ref_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref_dbg<F, R>(self, func: F) -> Selfwhere Self: AsRef<T>, F: FnOnce(&T) -> R,
tap_ref
in debug builds, and does nothing in release builds.§fn tap_ref_mut<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut<F, R>(self, func: F) -> Selfwhere Self: AsMut<T>, F: FnOnce(&mut T) -> R,
§fn tap_ref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: AsMut<T>, F: FnOnce(&mut T) -> R,
tap_ref_mut
in debug builds, and does nothing in release builds.§impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
impl<T, U> TapBorrow<U> for Twhere U: ?Sized,
§fn tap_borrow<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow<F, R>(self, func: F) -> Selfwhere Self: Borrow<T>, F: FnOnce(&T) -> R,
§fn tap_borrow_dbg<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow_dbg<F, R>(self, func: F) -> Selfwhere Self: Borrow<T>, F: FnOnce(&T) -> R,
tap_borrow
in debug builds, and does nothing in release builds.§fn tap_borrow_mut<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut<F, R>(self, func: F) -> Selfwhere Self: BorrowMut<T>, F: FnOnce(&mut T) -> R,
§fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: BorrowMut<T>, F: FnOnce(&mut T) -> R,
tap_borrow_mut
in debug builds, and does nothing in release
builds.§impl<T> TapDeref for T
impl<T> TapDeref for T
§fn tap_deref<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref<F, R>(self, func: F) -> Selfwhere Self: Deref, F: FnOnce(&Self::Target) -> R,
self
for inspection.§fn tap_deref_dbg<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref_dbg<F, R>(self, func: F) -> Selfwhere Self: Deref, F: FnOnce(&Self::Target) -> R,
tap_deref
in debug builds, and does nothing in release builds.§fn tap_deref_mut<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut<F, R>(self, func: F) -> Selfwhere Self: DerefMut, F: FnOnce(&mut Self::Target) -> R,
self
for modification.§fn tap_deref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: DerefMut, F: FnOnce(&mut Self::Target) -> R,
tap_deref_mut
in debug builds, and does nothing in release
builds.