pub struct IntervalQuery<'a> { /* private fields */ }
Expand description
A Query builder for specifying the input parameters to the intervals()
method in UnicodeVersion
.
The builder allows for a more convenient and readable way to specify the input parameters, instead of relying on multiple function arguments.
§Examples
use unicode_intervals::{UnicodeVersion, UnicodeCategory};
let intervals = UnicodeVersion::V15_0_0.query()
.include_categories(UnicodeCategory::UPPERCASE_LETTER | UnicodeCategory::LOWERCASE_LETTER)
.max_codepoint(128)
.include_characters("☃")
.intervals()
.expect("Invalid query input");
assert_eq!(intervals, &[(65, 90), (97, 122), (9731, 9731)]);
Implementations§
Source§impl<'a> IntervalQuery<'a>
impl<'a> IntervalQuery<'a>
Sourcepub fn include_categories(
self,
include_categories: impl Into<Option<UnicodeCategorySet>>,
) -> IntervalQuery<'a>
pub fn include_categories( self, include_categories: impl Into<Option<UnicodeCategorySet>>, ) -> IntervalQuery<'a>
Set include_categories
.
Sourcepub fn exclude_categories(
self,
exclude_categories: impl Into<Option<UnicodeCategorySet>>,
) -> IntervalQuery<'a>
pub fn exclude_categories( self, exclude_categories: impl Into<Option<UnicodeCategorySet>>, ) -> IntervalQuery<'a>
Set exclude_categories
.
Sourcepub fn include_characters(
self,
include_characters: &'a str,
) -> IntervalQuery<'a>
pub fn include_characters( self, include_characters: &'a str, ) -> IntervalQuery<'a>
Set include_characters
.
Sourcepub fn exclude_characters(
self,
exclude_characters: &'a str,
) -> IntervalQuery<'a>
pub fn exclude_characters( self, exclude_characters: &'a str, ) -> IntervalQuery<'a>
Set exclude_characters
.
Sourcepub fn min_codepoint(self, min_codepoint: u32) -> IntervalQuery<'a>
pub fn min_codepoint(self, min_codepoint: u32) -> IntervalQuery<'a>
Set min_codepoint
.
Sourcepub fn max_codepoint(self, max_codepoint: u32) -> IntervalQuery<'a>
pub fn max_codepoint(self, max_codepoint: u32) -> IntervalQuery<'a>
Set max_codepoint
.
Sourcepub fn intervals(&self) -> Result<Vec<Interval>, Error>
pub fn intervals(&self) -> Result<Vec<Interval>, Error>
Find intervals matching the query.
§Errors
min_codepoint > max_codepoint
min_codepoint > 1114111
ormax_codepoint > 1114111
Sourcepub fn interval_set(&self) -> Result<IntervalSet, Error>
pub fn interval_set(&self) -> Result<IntervalSet, Error>
Build an IndexSet
for the intervals matching the query.
§Errors
min_codepoint > max_codepoint
min_codepoint > 1114111
ormax_codepoint > 1114111
Trait Implementations§
Source§impl<'a> Clone for IntervalQuery<'a>
impl<'a> Clone for IntervalQuery<'a>
Source§fn clone(&self) -> IntervalQuery<'a>
fn clone(&self) -> IntervalQuery<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a> Debug for IntervalQuery<'a>
impl<'a> Debug for IntervalQuery<'a>
Source§impl<'a> PartialEq for IntervalQuery<'a>
impl<'a> PartialEq for IntervalQuery<'a>
impl<'a> StructuralPartialEq for IntervalQuery<'a>
Auto Trait Implementations§
impl<'a> Freeze for IntervalQuery<'a>
impl<'a> RefUnwindSafe for IntervalQuery<'a>
impl<'a> Send for IntervalQuery<'a>
impl<'a> Sync for IntervalQuery<'a>
impl<'a> Unpin for IntervalQuery<'a>
impl<'a> UnwindSafe for IntervalQuery<'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