Struct onig::Region[][src]

#[repr(transparent)]
pub struct Region { /* fields omitted */ }
Expand description

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

Implementations

Create a new empty 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.

Clone From Raw

Construct a new region based on an existing raw *onig_sys::OnigRegion pointer by copying.

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

Get the current capacity of the region.

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.

Get the size of the region.

Returns the number of registers in the region.

Check if the region is empty.

Returns true if there are no registers in the region.

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.

Get Capture Tree

Returns the capture tree for this region, if there is one.

Get an iterator over the captures in the region.

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.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Executes the destructor for this type. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.