Trait alloc::str::pattern::ReverseSearcher[][src]

pub unsafe trait ReverseSearcher<'a>: Searcher<'a> {
    fn next_back(&mut self) -> SearchStep;

    fn next_match_back(&mut self) -> Option<(usize, usize)> { ... }
fn next_reject_back(&mut self) -> Option<(usize, usize)> { ... } }
🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

Expand description

反向搜索字符串模式。

trait 提供了从字符串的后 (right) 开始搜索模式的非重叠匹配的方法。

如果该模式支持从后面搜索它,则将通过 Pattern trait 的关联 Searcher 类型实现。

trait 返回的索引范围不需要与反向搜索的正向搜索完全匹配。

由于该 trait 被标记为不安全的原因,请参见其父级 trait Searcher

Required methods

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

从后面开始执行下一个搜索步骤。

  • 如果 haystack[a..b] 与模式匹配,则返回 Match(a, b)
  • 如果 haystack[a..b] 甚至部分不匹配,则返回 Reject(a, b)
  • 如果已访问 haystack 的每个字节,则返回 Done

直到 DoneMatchReject 值流将包含相邻,不重叠,覆盖整个 haystack 并位于 utf8 边界上的索引范围。

Match 结果需要包含整个匹配的模式,但是 Reject 结果可以分为任意多个相邻的片段。两个范围的长度都可以为零。

例如,模式 "aaa" 和 haystack "cbaaaaab" 可能会产生流 [Reject(7, 8), Match(4, 7), Reject(1, 4), Reject(0, 1)]

Provided methods

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

查找下一个 Match 结果。 请参见 next_back()

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

查找下一个 Reject 结果。 请参见 next_back()

Implementors

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized