[−][src]Struct onig::Region
Represents a set of capture groups found in a search or match.
Implementations
impl Region
[src]
pub fn new() -> Region
[src]
Create a new empty Region
pub fn with_capacity(capacity: usize) -> Region
[src]
Create a new region with a given capacity. This function allocates
a new region object as in Region::new
and resizes it to
contain at least capacity
regions.
Arguments
capacity
- the number of captures this region should be capable of storing without allocation.
pub unsafe fn clone_from_raw(ptr: *mut OnigRegion) -> Self
[src]
Clone From Raw
Construct a new region based on an existing raw
*onig_sys::OnigRegion
pointer by copying.
pub fn clear(&mut self)
[src]
This can be used to clear out a region so it can be used
again. See onig_sys::onig_region_clear
pub fn capacity(&self) -> usize
[src]
Get the current capacity of the region.
pub fn reserve(&mut self, new_capacity: usize)
[src]
Updates the region to contain new_capacity
slots. See
onig_sys::onig_region_resize
for mor
information.
Arguments
new_capacity
- The new number of groups in the region.
pub fn len(&self) -> usize
[src]
Get the size of the region.
Returns the number of registers in the region.
pub fn is_empty(&self) -> bool
[src]
Check if the region is empty.
Returns true if there are no registers in the region.
pub fn pos(&self, pos: usize) -> Option<(usize, usize)>
[src]
Returns the start and end positions of the Nth capture group.
Returns None
if pos
is not a valid capture group or if the
capture group did not match anything. The positions returned
are always byte indices with respect to the original string
matched.
pub fn tree(&self) -> Option<&CaptureTreeNode>
[src]
Get Capture Tree
Returns the capture tree for this region, if there is one.
pub fn iter(&self) -> RegionIter
[src]
Get an iterator over the captures in the region.
pub fn tree_traverse<F>(&self, callback: F) -> i32 where
F: Fn(u32, (usize, usize), u32) -> bool,
[src]
F: Fn(u32, (usize, usize), u32) -> bool,
Walk the Tree of Captures
The given callback is invoked for each node in the capture tree. Each node is passed to the callback before any children.
pub fn tree_traverse_at<F>(&self, at: TraverseCallbackAt, callback: F) -> i32 where
F: Fn(u32, (usize, usize), u32) -> bool,
[src]
F: Fn(u32, (usize, usize), u32) -> bool,
Walk the Tree of Captures in a Given Order
The given callback is invoked for each node in the capture tree. The order in which the callback is invoked can be chosen.
Trait Implementations
impl Clone for Region
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Region
[src]
impl Default for Region
[src]
impl Drop for Region
[src]
impl Eq for Region
[src]
impl<'a> IntoIterator for &'a Region
[src]
type Item = (usize, usize)
The type of the elements being iterated over.
type IntoIter = RegionIter<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl PartialEq<Region> for Region
[src]
impl StructuralEq for Region
[src]
impl StructuralPartialEq for Region
[src]
Auto Trait Implementations
impl RefUnwindSafe for Region
impl !Send for Region
impl !Sync for Region
impl Unpin for Region
impl UnwindSafe for Region
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,