mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-24 21:17:01 +01:00
250 lines
68 KiB
HTML
250 lines
68 KiB
HTML
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `ESCAPES_RE` struct in crate `kanidmd_lib`."><meta name="keywords" content="rust, rustlang, rust-lang, ESCAPES_RE"><title>ESCAPES_RE in kanidmd_lib::value - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-93196c7a1c3542a8.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../static.files/light-4743e13df3dfe8c4.css"><link rel="stylesheet" disabled href="../../static.files/dark-0e1b889528bd466b.css"><link rel="stylesheet" disabled href="../../static.files/ayu-65289d5d067c7c66.css"><script id="default-settings" ></script><script src="../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-3367e395607fafc1.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="logo-container" href="../../kanidmd_lib/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../kanidmd_lib/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">ESCAPES_RE</a></h2><div class="sidebar-elems"><section><h3><a href="#deref-methods-Regex">Methods from Deref<Target=Regex></a></h3><ul class="block"><li><a href="#method.as_str">as_str</a></li><li><a href="#method.capture_locations">capture_locations</a></li><li><a href="#method.capture_names">capture_names</a></li><li><a href="#method.captures">captures</a></li><li><a href="#method.captures_iter">captures_iter</a></li><li><a href="#method.captures_len">captures_len</a></li><li><a href="#method.captures_read">captures_read</a></li><li><a href="#method.captures_read_at">captures_read_at</a></li><li><a href="#method.find">find</a></li><li><a href="#method.find_at">find_at</a></li><li><a href="#method.find_iter">find_iter</a></li><li><a href="#method.is_match">is_match</a></li><li><a href="#method.is_match_at">is_match_at</a></li><li><a href="#method.replace">replace</a></li><li><a href="#method.replace_all">replace_all</a></li><li><a href="#method.replacen">replacen</a></li><li><a href="#method.shortest_match">shortest_match</a></li><li><a href="#method.shortest_match_at">shortest_match_at</a></li><li><a href="#method.split">split</a></li><li><a href="#method.splitn">splitn</a></li></
|
|||
|
string given.</p>
|
|||
|
<p>It is recommended to use this method if all you need to do is test
|
|||
|
a match, since the underlying matching engine may be able to do less
|
|||
|
work.</p>
|
|||
|
<h5 id="example"><a href="#example">Example</a></h5>
|
|||
|
<p>Test if some text contains at least one word with exactly 13
|
|||
|
Unicode word characters:</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>text = <span class="string">"I categorically deny having triskaidekaphobia."</span>;
|
|||
|
<span class="macro">assert!</span>(Regex::new(<span class="string">r"\b\w{13}\b"</span>).unwrap().is_match(text));</code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.find" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.find" class="fn">find</a><'t>(&self, text: &'t <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.68.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Match<'t>></h4></section></summary><div class="docblock"><p>Returns the start and end byte range of the leftmost-first match in
|
|||
|
<code>text</code>. If no match exists, then <code>None</code> is returned.</p>
|
|||
|
<p>Note that this should only be used if you want to discover the position
|
|||
|
of the match. Testing the existence of a match is faster if you use
|
|||
|
<code>is_match</code>.</p>
|
|||
|
<h5 id="example-1"><a href="#example-1">Example</a></h5>
|
|||
|
<p>Find the start and end location of the first word with exactly 13
|
|||
|
Unicode word characters:</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>text = <span class="string">"I categorically deny having triskaidekaphobia."</span>;
|
|||
|
<span class="kw">let </span>mat = Regex::new(<span class="string">r"\b\w{13}\b"</span>).unwrap().find(text).unwrap();
|
|||
|
<span class="macro">assert_eq!</span>(mat.start(), <span class="number">2</span>);
|
|||
|
<span class="macro">assert_eq!</span>(mat.end(), <span class="number">15</span>);</code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.find_iter" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.find_iter" class="fn">find_iter</a><'r, 't>(&'r self, text: &'t <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>) -> Matches<'r, 't></h4></section></summary><div class="docblock"><p>Returns an iterator for each successive non-overlapping match in
|
|||
|
<code>text</code>, returning the start and end byte indices with respect to
|
|||
|
<code>text</code>.</p>
|
|||
|
<h5 id="example-2"><a href="#example-2">Example</a></h5>
|
|||
|
<p>Find the start and end location of every word with exactly 13 Unicode
|
|||
|
word characters:</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>text = <span class="string">"Retroactively relinquishing remunerations is reprehensible."</span>;
|
|||
|
<span class="kw">for </span>mat <span class="kw">in </span>Regex::new(<span class="string">r"\b\w{13}\b"</span>).unwrap().find_iter(text) {
|
|||
|
<span class="macro">println!</span>(<span class="string">"{:?}"</span>, mat);
|
|||
|
}</code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.captures" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.captures" class="fn">captures</a><'t>(&self, text: &'t <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.68.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Captures<'t>></h4></section></summary><div class="docblock"><p>Returns the capture groups corresponding to the leftmost-first
|
|||
|
match in <code>text</code>. Capture group <code>0</code> always corresponds to the entire
|
|||
|
match. If no match is found, then <code>None</code> is returned.</p>
|
|||
|
<p>You should only use <code>captures</code> if you need access to the location of
|
|||
|
capturing group matches. Otherwise, <code>find</code> is faster for discovering
|
|||
|
the location of the overall match.</p>
|
|||
|
<h5 id="examples"><a href="#examples">Examples</a></h5>
|
|||
|
<p>Say you have some text with movie names and their release years,
|
|||
|
like “‘Citizen Kane’ (1941)”. It’d be nice if we could search for text
|
|||
|
looking like that, while also extracting the movie name and its release
|
|||
|
year separately.</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>re = Regex::new(<span class="string">r"'([^']+)'\s+\((\d{4})\)"</span>).unwrap();
|
|||
|
<span class="kw">let </span>text = <span class="string">"Not my favorite movie: 'Citizen Kane' (1941)."</span>;
|
|||
|
<span class="kw">let </span>caps = re.captures(text).unwrap();
|
|||
|
<span class="macro">assert_eq!</span>(caps.get(<span class="number">1</span>).unwrap().as_str(), <span class="string">"Citizen Kane"</span>);
|
|||
|
<span class="macro">assert_eq!</span>(caps.get(<span class="number">2</span>).unwrap().as_str(), <span class="string">"1941"</span>);
|
|||
|
<span class="macro">assert_eq!</span>(caps.get(<span class="number">0</span>).unwrap().as_str(), <span class="string">"'Citizen Kane' (1941)"</span>);
|
|||
|
<span class="comment">// You can also access the groups by index using the Index notation.
|
|||
|
// Note that this will panic on an invalid index.
|
|||
|
</span><span class="macro">assert_eq!</span>(<span class="kw-2">&</span>caps[<span class="number">1</span>], <span class="string">"Citizen Kane"</span>);
|
|||
|
<span class="macro">assert_eq!</span>(<span class="kw-2">&</span>caps[<span class="number">2</span>], <span class="string">"1941"</span>);
|
|||
|
<span class="macro">assert_eq!</span>(<span class="kw-2">&</span>caps[<span class="number">0</span>], <span class="string">"'Citizen Kane' (1941)"</span>);</code></pre></div>
|
|||
|
<p>Note that the full match is at capture group <code>0</code>. Each subsequent
|
|||
|
capture group is indexed by the order of its opening <code>(</code>.</p>
|
|||
|
<p>We can make this example a bit clearer by using <em>named</em> capture groups:</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>re = Regex::new(<span class="string">r"'(?P<title>[^']+)'\s+\((?P<year>\d{4})\)"</span>)
|
|||
|
.unwrap();
|
|||
|
<span class="kw">let </span>text = <span class="string">"Not my favorite movie: 'Citizen Kane' (1941)."</span>;
|
|||
|
<span class="kw">let </span>caps = re.captures(text).unwrap();
|
|||
|
<span class="macro">assert_eq!</span>(caps.name(<span class="string">"title"</span>).unwrap().as_str(), <span class="string">"Citizen Kane"</span>);
|
|||
|
<span class="macro">assert_eq!</span>(caps.name(<span class="string">"year"</span>).unwrap().as_str(), <span class="string">"1941"</span>);
|
|||
|
<span class="macro">assert_eq!</span>(caps.get(<span class="number">0</span>).unwrap().as_str(), <span class="string">"'Citizen Kane' (1941)"</span>);
|
|||
|
<span class="comment">// You can also access the groups by name using the Index notation.
|
|||
|
// Note that this will panic on an invalid group name.
|
|||
|
</span><span class="macro">assert_eq!</span>(<span class="kw-2">&</span>caps[<span class="string">"title"</span>], <span class="string">"Citizen Kane"</span>);
|
|||
|
<span class="macro">assert_eq!</span>(<span class="kw-2">&</span>caps[<span class="string">"year"</span>], <span class="string">"1941"</span>);
|
|||
|
<span class="macro">assert_eq!</span>(<span class="kw-2">&</span>caps[<span class="number">0</span>], <span class="string">"'Citizen Kane' (1941)"</span>);
|
|||
|
</code></pre></div>
|
|||
|
<p>Here we name the capture groups, which we can access with the <code>name</code>
|
|||
|
method or the <code>Index</code> notation with a <code>&str</code>. Note that the named
|
|||
|
capture groups are still accessible with <code>get</code> or the <code>Index</code> notation
|
|||
|
with a <code>usize</code>.</p>
|
|||
|
<p>The <code>0</code>th capture group is always unnamed, so it must always be
|
|||
|
accessed with <code>get(0)</code> or <code>[0]</code>.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.captures_iter" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.captures_iter" class="fn">captures_iter</a><'r, 't>(&'r self, text: &'t <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>) -> CaptureMatches<'r, 't></h4></section></summary><div class="docblock"><p>Returns an iterator over all the non-overlapping capture groups matched
|
|||
|
in <code>text</code>. This is operationally the same as <code>find_iter</code>, except it
|
|||
|
yields information about capturing group matches.</p>
|
|||
|
<h5 id="example-3"><a href="#example-3">Example</a></h5>
|
|||
|
<p>We can use this to find all movie titles and their release years in
|
|||
|
some text, where the movie is formatted like “‘Title’ (xxxx)”:</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>re = Regex::new(<span class="string">r"'(?P<title>[^']+)'\s+\((?P<year>\d{4})\)"</span>)
|
|||
|
.unwrap();
|
|||
|
<span class="kw">let </span>text = <span class="string">"'Citizen Kane' (1941), 'The Wizard of Oz' (1939), 'M' (1931)."</span>;
|
|||
|
<span class="kw">for </span>caps <span class="kw">in </span>re.captures_iter(text) {
|
|||
|
<span class="macro">println!</span>(<span class="string">"Movie: {:?}, Released: {:?}"</span>,
|
|||
|
<span class="kw-2">&</span>caps[<span class="string">"title"</span>], <span class="kw-2">&</span>caps[<span class="string">"year"</span>]);
|
|||
|
}
|
|||
|
<span class="comment">// Output:
|
|||
|
// Movie: Citizen Kane, Released: 1941
|
|||
|
// Movie: The Wizard of Oz, Released: 1939
|
|||
|
// Movie: M, Released: 1931</span></code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.split" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.split" class="fn">split</a><'r, 't>(&'r self, text: &'t <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>) -> Split<'r, 't></h4></section></summary><div class="docblock"><p>Returns an iterator of substrings of <code>text</code> delimited by a match of the
|
|||
|
regular expression. Namely, each element of the iterator corresponds to
|
|||
|
text that <em>isn’t</em> matched by the regular expression.</p>
|
|||
|
<p>This method will <em>not</em> copy the text given.</p>
|
|||
|
<h5 id="example-4"><a href="#example-4">Example</a></h5>
|
|||
|
<p>To split a string delimited by arbitrary amounts of spaces or tabs:</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>re = Regex::new(<span class="string">r"[ \t]+"</span>).unwrap();
|
|||
|
<span class="kw">let </span>fields: Vec<<span class="kw-2">&</span>str> = re.split(<span class="string">"a b \t c\td e"</span>).collect();
|
|||
|
<span class="macro">assert_eq!</span>(fields, <span class="macro">vec!</span>[<span class="string">"a"</span>, <span class="string">"b"</span>, <span class="string">"c"</span>, <span class="string">"d"</span>, <span class="string">"e"</span>]);</code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.splitn" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.splitn" class="fn">splitn</a><'r, 't>(&'r self, text: &'t <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>, limit: <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a>) -> SplitN<'r, 't></h4></section></summary><div class="docblock"><p>Returns an iterator of at most <code>limit</code> substrings of <code>text</code> delimited
|
|||
|
by a match of the regular expression. (A <code>limit</code> of <code>0</code> will return no
|
|||
|
substrings.) Namely, each element of the iterator corresponds to text
|
|||
|
that <em>isn’t</em> matched by the regular expression. The remainder of the
|
|||
|
string that is not split will be the last element in the iterator.</p>
|
|||
|
<p>This method will <em>not</em> copy the text given.</p>
|
|||
|
<h5 id="example-5"><a href="#example-5">Example</a></h5>
|
|||
|
<p>Get the first two words in some text:</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>re = Regex::new(<span class="string">r"\W+"</span>).unwrap();
|
|||
|
<span class="kw">let </span>fields: Vec<<span class="kw-2">&</span>str> = re.splitn(<span class="string">"Hey! How are you?"</span>, <span class="number">3</span>).collect();
|
|||
|
<span class="macro">assert_eq!</span>(fields, <span class="macro">vec!</span>(<span class="string">"Hey"</span>, <span class="string">"How"</span>, <span class="string">"are you?"</span>));</code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.replace" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.replace" class="fn">replace</a><R, 't>(&self, text: &'t <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>, rep: R) -> <a class="enum" href="https://doc.rust-lang.org/1.68.1/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'t, <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>><span class="where fmt-newline">where<br> R: Replacer,</span></h4></section></summary><div class="docblock"><p>Replaces the leftmost-first match with the replacement provided.
|
|||
|
The replacement can be a regular string (where <code>$N</code> and <code>$name</code> are
|
|||
|
expanded to match capture groups) or a function that takes the matches’
|
|||
|
<code>Captures</code> and returns the replaced string.</p>
|
|||
|
<p>If no match is found, then a copy of the string is returned unchanged.</p>
|
|||
|
<h5 id="replacement-string-syntax"><a href="#replacement-string-syntax">Replacement string syntax</a></h5>
|
|||
|
<p>All instances of <code>$name</code> in the replacement text is replaced with the
|
|||
|
corresponding capture group <code>name</code>.</p>
|
|||
|
<p><code>name</code> may be an integer corresponding to the index of the
|
|||
|
capture group (counted by order of opening parenthesis where <code>0</code> is the
|
|||
|
entire match) or it can be a name (consisting of letters, digits or
|
|||
|
underscores) corresponding to a named capture group.</p>
|
|||
|
<p>If <code>name</code> isn’t a valid capture group (whether the name doesn’t exist
|
|||
|
or isn’t a valid index), then it is replaced with the empty string.</p>
|
|||
|
<p>The longest possible name is used. e.g., <code>$1a</code> looks up the capture
|
|||
|
group named <code>1a</code> and not the capture group at index <code>1</code>. To exert more
|
|||
|
precise control over the name, use braces, e.g., <code>${1}a</code>.</p>
|
|||
|
<p>To write a literal <code>$</code> use <code>$$</code>.</p>
|
|||
|
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
|
|||
|
<p>Note that this function is polymorphic with respect to the replacement.
|
|||
|
In typical usage, this can just be a normal string:</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>re = Regex::new(<span class="string">"[^01]+"</span>).unwrap();
|
|||
|
<span class="macro">assert_eq!</span>(re.replace(<span class="string">"1078910"</span>, <span class="string">""</span>), <span class="string">"1010"</span>);</code></pre></div>
|
|||
|
<p>But anything satisfying the <code>Replacer</code> trait will work. For example,
|
|||
|
a closure of type <code>|&Captures| -> String</code> provides direct access to the
|
|||
|
captures corresponding to a match. This allows one to access
|
|||
|
capturing group matches easily:</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>re = Regex::new(<span class="string">r"([^,\s]+),\s+(\S+)"</span>).unwrap();
|
|||
|
<span class="kw">let </span>result = re.replace(<span class="string">"Springsteen, Bruce"</span>, |caps: <span class="kw-2">&</span>Captures| {
|
|||
|
<span class="macro">format!</span>(<span class="string">"{} {}"</span>, <span class="kw-2">&</span>caps[<span class="number">2</span>], <span class="kw-2">&</span>caps[<span class="number">1</span>])
|
|||
|
});
|
|||
|
<span class="macro">assert_eq!</span>(result, <span class="string">"Bruce Springsteen"</span>);</code></pre></div>
|
|||
|
<p>But this is a bit cumbersome to use all the time. Instead, a simple
|
|||
|
syntax is supported that expands <code>$name</code> into the corresponding capture
|
|||
|
group. Here’s the last example, but using this expansion technique
|
|||
|
with named capture groups:</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>re = Regex::new(<span class="string">r"(?P<last>[^,\s]+),\s+(?P<first>\S+)"</span>).unwrap();
|
|||
|
<span class="kw">let </span>result = re.replace(<span class="string">"Springsteen, Bruce"</span>, <span class="string">"$first $last"</span>);
|
|||
|
<span class="macro">assert_eq!</span>(result, <span class="string">"Bruce Springsteen"</span>);</code></pre></div>
|
|||
|
<p>Note that using <code>$2</code> instead of <code>$first</code> or <code>$1</code> instead of <code>$last</code>
|
|||
|
would produce the same result. To write a literal <code>$</code> use <code>$$</code>.</p>
|
|||
|
<p>Sometimes the replacement string requires use of curly braces to
|
|||
|
delineate a capture group replacement and surrounding literal text.
|
|||
|
For example, if we wanted to join two words together with an
|
|||
|
underscore:</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>re = Regex::new(<span class="string">r"(?P<first>\w+)\s+(?P<second>\w+)"</span>).unwrap();
|
|||
|
<span class="kw">let </span>result = re.replace(<span class="string">"deep fried"</span>, <span class="string">"${first}_$second"</span>);
|
|||
|
<span class="macro">assert_eq!</span>(result, <span class="string">"deep_fried"</span>);</code></pre></div>
|
|||
|
<p>Without the curly braces, the capture group name <code>first_</code> would be
|
|||
|
used, and since it doesn’t exist, it would be replaced with the empty
|
|||
|
string.</p>
|
|||
|
<p>Finally, sometimes you just want to replace a literal string with no
|
|||
|
regard for capturing group expansion. This can be done by wrapping a
|
|||
|
byte string with <code>NoExpand</code>:</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex::NoExpand;
|
|||
|
|
|||
|
<span class="kw">let </span>re = Regex::new(<span class="string">r"(?P<last>[^,\s]+),\s+(\S+)"</span>).unwrap();
|
|||
|
<span class="kw">let </span>result = re.replace(<span class="string">"Springsteen, Bruce"</span>, NoExpand(<span class="string">"$2 $last"</span>));
|
|||
|
<span class="macro">assert_eq!</span>(result, <span class="string">"$2 $last"</span>);</code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.replace_all" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.replace_all" class="fn">replace_all</a><R, 't>(&self, text: &'t <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>, rep: R) -> <a class="enum" href="https://doc.rust-lang.org/1.68.1/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'t, <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>><span class="where fmt-newline">where<br> R: Replacer,</span></h4></section></summary><div class="docblock"><p>Replaces all non-overlapping matches in <code>text</code> with the replacement
|
|||
|
provided. This is the same as calling <code>replacen</code> with <code>limit</code> set to
|
|||
|
<code>0</code>.</p>
|
|||
|
<p>See the documentation for <code>replace</code> for details on how to access
|
|||
|
capturing group matches in the replacement string.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.replacen" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.replacen" class="fn">replacen</a><R, 't>(&self, text: &'t <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>, limit: <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a>, rep: R) -> <a class="enum" href="https://doc.rust-lang.org/1.68.1/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'t, <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>><span class="where fmt-newline">where<br> R: Replacer,</span></h4></section></summary><div class="docblock"><p>Replaces at most <code>limit</code> non-overlapping matches in <code>text</code> with the
|
|||
|
replacement provided. If <code>limit</code> is 0, then all non-overlapping matches
|
|||
|
are replaced.</p>
|
|||
|
<p>See the documentation for <code>replace</code> for details on how to access
|
|||
|
capturing group matches in the replacement string.</p>
|
|||
|
</div></details></div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.shortest_match" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.shortest_match" class="fn">shortest_match</a>(&self, text: &<a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.68.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a>></h4></section></summary><div class="docblock"><p>Returns the end location of a match in the text given.</p>
|
|||
|
<p>This method may have the same performance characteristics as
|
|||
|
<code>is_match</code>, except it provides an end location for a match. In
|
|||
|
particular, the location returned <em>may be shorter</em> than the proper end
|
|||
|
of the leftmost-first match.</p>
|
|||
|
<h5 id="example-6"><a href="#example-6">Example</a></h5>
|
|||
|
<p>Typically, <code>a+</code> would match the entire first sequence of <code>a</code> in some
|
|||
|
text, but <code>shortest_match</code> can give up as soon as it sees the first
|
|||
|
<code>a</code>.</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>text = <span class="string">"aaaaa"</span>;
|
|||
|
<span class="kw">let </span>pos = Regex::new(<span class="string">r"a+"</span>).unwrap().shortest_match(text);
|
|||
|
<span class="macro">assert_eq!</span>(pos, <span class="prelude-val">Some</span>(<span class="number">1</span>));</code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.shortest_match_at" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.shortest_match_at" class="fn">shortest_match_at</a>(&self, text: &<a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>, start: <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.68.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a>></h4></section></summary><div class="docblock"><p>Returns the same as shortest_match, but starts the search at the given
|
|||
|
offset.</p>
|
|||
|
<p>The significance of the starting point is that it takes the surrounding
|
|||
|
context into consideration. For example, the <code>\A</code> anchor can only
|
|||
|
match when <code>start == 0</code>.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_match_at" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.is_match_at" class="fn">is_match_at</a>(&self, text: &<a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>, start: <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns the same as is_match, but starts the search at the given
|
|||
|
offset.</p>
|
|||
|
<p>The significance of the starting point is that it takes the surrounding
|
|||
|
context into consideration. For example, the <code>\A</code> anchor can only
|
|||
|
match when <code>start == 0</code>.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.find_at" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.find_at" class="fn">find_at</a><'t>(&self, text: &'t <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>, start: <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.68.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Match<'t>></h4></section></summary><div class="docblock"><p>Returns the same as find, but starts the search at the given
|
|||
|
offset.</p>
|
|||
|
<p>The significance of the starting point is that it takes the surrounding
|
|||
|
context into consideration. For example, the <code>\A</code> anchor can only
|
|||
|
match when <code>start == 0</code>.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.captures_read" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.captures_read" class="fn">captures_read</a><'t>(<br> &self,<br> locs: &mut CaptureLocations,<br> text: &'t <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/1.68.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Match<'t>></h4></section></summary><div class="docblock"><p>This is like <code>captures</code>, but uses
|
|||
|
<a href="struct.CaptureLocations.html"><code>CaptureLocations</code></a>
|
|||
|
instead of
|
|||
|
<a href="struct.Captures.html"><code>Captures</code></a> in order to amortize allocations.</p>
|
|||
|
<p>To create a <code>CaptureLocations</code> value, use the
|
|||
|
<code>Regex::capture_locations</code> method.</p>
|
|||
|
<p>This returns the overall match if this was successful, which is always
|
|||
|
equivalence to the <code>0</code>th capture group.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.captures_read_at" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.captures_read_at" class="fn">captures_read_at</a><'t>(<br> &self,<br> locs: &mut CaptureLocations,<br> text: &'t <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a>,<br> start: <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/1.68.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Match<'t>></h4></section></summary><div class="docblock"><p>Returns the same as captures, but starts the search at the given
|
|||
|
offset and populates the capture locations given.</p>
|
|||
|
<p>The significance of the starting point is that it takes the surrounding
|
|||
|
context into consideration. For example, the <code>\A</code> anchor can only
|
|||
|
match when <code>start == 0</code>.</p>
|
|||
|
</div></details></div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_str" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.as_str" class="fn">as_str</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.str.html">str</a></h4></section></summary><div class="docblock"><p>Returns the original string of this regex.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.capture_names" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.capture_names" class="fn">capture_names</a>(&self) -> CaptureNames<'_></h4></section></summary><div class="docblock"><p>Returns an iterator over the capture names.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.captures_len" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.captures_len" class="fn">captures_len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the number of captures.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.capture_locations" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.capture_locations" class="fn">capture_locations</a>(&self) -> CaptureLocations</h4></section></summary><div class="docblock"><p>Returns an empty set of capture locations that can be reused in
|
|||
|
multiple calls to <code>captures_read</code> or <code>captures_read_at</code>.</p>
|
|||
|
</div></details></div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Deref-for-ESCAPES_RE" class="impl has-srclink"><a class="srclink rightside" href="../../src/kanidmd_lib/value.rs.html#38-84">source</a><a href="#impl-Deref-for-ESCAPES_RE" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.68.1/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="struct.ESCAPES_RE.html" title="struct kanidmd_lib::value::ESCAPES_RE">ESCAPES_RE</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Target" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Target" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.68.1/core/ops/deref/trait.Deref.html#associatedtype.Target" class="associatedtype">Target</a> = Regex</h4></section></summary><div class='docblock'>The resulting type after dereferencing.</div></details><details class="toggle method-toggle" open><summary><section id="method.deref" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/kanidmd_lib/value.rs.html#38-84">source</a><a href="#method.deref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.68.1/core/ops/deref/trait.Deref.html#tymethod.deref" class="fn">deref</a>(&self) -> &Regex</h4></section></summary><div class='docblock'>Dereferences the value.</div></details></div></details><section id="impl-LazyStatic-for-ESCAPES_RE" class="impl has-srclink"><a class="srclink rightside" href="../../src/kanidmd_lib/value.rs.html#38-84">source</a><a href="#impl-LazyStatic-for-ESCAPES_RE" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://docs.rs/lazy_static/1.4.0/lazy_static/trait.LazyStatic.html" title="trait lazy_static::LazyStatic">LazyStatic</a> for <a class="struct" href="struct.ESCAPES_RE.html" title="struct kanidmd_lib::value::ESCAPES_RE">ESCAPES_RE</a></h3></section></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-ESCAPES_RE" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-ESCAPES_RE" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.68.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.ESCAPES_RE.html" title="struct kanidmd_lib::value::ESCAPES_RE">ESCAPES_RE</a></h3></section><section id="impl-Send-for-ESCAPES_RE" class="impl has-srclink"><a href="#impl-Send-for-ESCAPES_RE" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.68.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.ESCAPES_RE.html" title="struct kanidmd_lib::value::ESCAPES_RE">ESCAPES_RE</a></h3></section><section id="impl-Sync-for-ESCAPES_RE" class="impl has-srclink"><a href="#impl-Sync-for-ESCAPES_RE" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.68.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.ESCAPES_RE.html" title="struct kanidmd_lib::value::ESCAPES_RE">ESCAPES_RE</a></h3></section><section id="impl-Unpin-for-ESCAPES_RE" class="impl has-srclink"><a href="#impl-Unpin-for-ESCAPES_RE" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.68.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.ESCAPES_RE.html
|
|||
|
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Instrument-for-ESCAPES_RE" class="impl has-srclink"><a class="srclink rightside" href="https://docs.rs/tracing/0.1.37/src/tracing/instrument.rs.html#276">source</a><a href="#impl-Instrument-for-ESCAPES_RE" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.instrument" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://docs.rs/tracing/0.1.37/src/tracing/instrument.rs.html#82">source</a><a href="#method.instrument" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.Instrument.html#method.instrument" class="fn">instrument</a>(self, span: <a class="struct" href="https://docs.rs/tracing/0.1.37/tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -> <a class="struct" href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></section></summary><div class='docblock'>Instruments this type with the provided <a href="https://docs.rs/tracing/0.1.37/tracing/span/struct.Span.html" title="Span"><code>Span</code></a>, returning an
|
|||
|
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.in_current_span" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://docs.rs/tracing/0.1.37/src/tracing/instrument.rs.html#121">source</a><a href="#method.in_current_span" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.Instrument.html#method.in_current_span" class="fn">in_current_span</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></section></summary><div class='docblock'>Instruments this type with the <a href="https://docs.rs/tracing/0.1.37/tracing/span/struct.Span.html#method.current">current</a> <a href="https://docs.rs/tracing/0.1.37/tracing/span/struct.Span.html"><code>Span</code></a>, returning an
|
|||
|
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-ESCAPES_RE" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/1.68.1/src/core/convert/mod.rs.html#717">source</a><a href="#impl-Into%3CU%3E-for-ESCAPES_RE" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.68.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/1.68.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/1.68.1/src/core/convert/mod.rs.html#725">source</a></span><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.68.1/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
|
|||
|
<p>That is, this conversion is whatever the implementation of
|
|||
|
<code><a href="https://doc.rust-lang.org/1.68.1/core/convert/trait.From.html" title="From">From</a><T> for U</code> chooses to do.</p>
|
|||
|
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Pointable-for-ESCAPES_RE" class="impl has-srclink"><a href="#impl-Pointable-for-ESCAPES_RE" class="anchor">§</a><h3 class="code-header">impl<T> Pointable for T</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedconstant.ALIGN" class="associatedconstant trait-impl has-srclink"><a href="#associatedconstant.ALIGN" class="anchor">§</a><h4 class="code-header">const <a class="constant">ALIGN</a>: <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a> = mem::align_of::<T>()</h4></section></summary><div class='docblock'>The alignment of pointer.</div></details><details class="toggle" open><summary><section id="associatedtype.Init" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Init" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Init</a> = T</h4></section></summary><div class='docblock'>The type for initializers.</div></details><details class="toggle method-toggle" open><summary><section id="method.init" class="method trait-impl has-srclink"><a href="#method.init" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">init</a>(init: <T as Pointable>::Init) -> <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Initializes a with the given initializer. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.deref-1" class="method trait-impl has-srclink"><a href="#method.deref-1" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">deref</a><'a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.reference.html">&'a </a>T</h4></section></summary><div class='docblock'>Dereferences the given pointer. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.deref_mut" class="method trait-impl has-srclink"><a href="#method.deref_mut" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">deref_mut</a><'a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.reference.html">&'a mut </a>T</h4></section></summary><div class='docblock'>Mutably dereferences the given pointer. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.drop" class="method trait-impl has-srclink"><a href="#method.drop" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">drop</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.68.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Drops the object pointed to by the given pointer. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Same%3CT%3E-for-ESCAPES_RE" class="impl has-srclink"><a class="srclink rightside" href="https://docs.rs/typenum/1.16.0/src/typenum/type_operators.rs.html#34">source</a><a href="#impl-Same%3CT%3E-for-ESCAPES_RE" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://docs.rs/typenum/1.16.0/typenum/type_operators/trait.Same.html" title="trait typenum::type_operators::Same">Same</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a href="https://docs.rs/typenum/1.16.0/typenum/type_operators/trait.Same.html#associatedtype.Output" class="associatedtype">Output</a> = T</h4></section></summary><div c
|
|||
|
<a href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.WithSubscriber.html#method.with_subscriber">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.with_current_subscriber" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://docs.rs/tracing/0.1.37/src/tracing/instrument.rs.html#221">source</a><a href="#method.with_current_subscriber" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber" class="fn">with_current_subscriber</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self></h4></section></summary><div class='docblock'>Attaches the current <a href="https://docs.rs/tracing/0.1.37/tracing/dispatcher/index.html#setting-the-default-subscriber">default</a> <a href="https://docs.rs/tracing-core/0.1.22/tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
|
|||
|
<a href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber">Read more</a></div></details></div></details></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="kanidmd_lib" data-themes="" data-resource-suffix="" data-rustdoc-version="1.68.1 (8460ca823 2023-03-20)" data-search-js="search-98d53477a794af0b.js" data-settings-js="settings-c3c521c753752a1a.js" data-settings-css="settings-08ddfdda51b8ee2e.css" ></div></body></html>
|