Struct unicode_intervals::IntervalQuery
source · 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_codepointmin_codepoint > 1114111ormax_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_codepointmin_codepoint > 1114111ormax_codepoint > 1114111
Trait Implementations§
Auto Trait Implementations§
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