Struct onig::Region [] [src]

pub struct Region {
    // some fields omitted
}

Represents a set of capture groups found in a search or match.

Methods

impl Region
[src]

fn new() -> Region

Create a new empty Region

fn with_capacity(capacity: usize) -> Region

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.

fn clear(&mut self)

This can be used to clear out a region so it can be used again. See onig_sys::onig_region_clear

fn capacity(&self) -> usize

fn reserve(&mut self, new_capacity: usize)

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.

fn len(&self) -> usize

Get the size of the region. Returns the number of registers in the region.

fn pos(&self, pos: usize) -> Option<(usize, usize)>

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.

fn tree(&self) -> Option<&CaptureTreeNode>

Trait Implementations

impl Debug for Region
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Drop for Region
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more

impl Clone for Region
[src]

fn clone(&self) -> Self

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more