Skip to main content

OpPlan

Struct OpPlan 

Source
pub struct OpPlan {
    pub ops: Vec<Op>,
}
Expand description

Sequential pipeline of ops. The first op produces an initial state (no input bitmap; ops at position 0 run with a universal “all” state so loaders fold via AND). Build via the fluent API; finalise with optimize() then run().

Fields§

§ops: Vec<Op>

Ops applied in document order. Public so callers can introspect the optimiser’s output for testing / debugging.

Implementations§

Source§

impl OpPlan

Source

pub fn new() -> Self

Create an empty plan. Each call appends an op.

Source

pub fn push(self, op: Op) -> Self

Append a raw op. Most callers use the fluent helpers below.

Source

pub fn anchor(self, root: TokenId) -> Self

Anchor the plan at a single token (typically the root or a result from a prior subquery).

Source

pub fn all(self) -> Self

Set state to “every token in the document”.

Source

pub fn by_key(self, name: &str) -> Self

Restrict to tokens that are object keys with the given name.

Source

pub fn at_depth(self, d: u16) -> Self

Restrict to tokens at the given nesting depth.

Source

pub fn within(self, root: TokenId) -> Self

Restrict to tokens inside the subtree rooted at root.

Source

pub fn descend(self) -> Self

Expand each token to its full subtree (descendant operator).

Source

pub fn children(self) -> Self

Expand each container to its immediate child tokens.

Source

pub fn field(self, name: &str) -> Self

Drill into the named field — for each container in state, take the value bound to that key.

Source

pub fn value_eq(self, lit: &[u8]) -> Self

Filter state to tokens whose byte span equals lit (string-aware).

Source

pub fn first(self) -> Self

Reduce to the smallest token id.

Source

pub fn last(self) -> Self

Reduce to the largest token id.

Source

pub fn nth(self, k: u32) -> Self

Reduce to the k-th token id in ascending order.

Source

pub fn count(self) -> Self

Reduce to a singleton bitmap encoding the cardinality of state.

Source

pub fn optimize(self) -> Self

Algebraic optimiser. Fixed-point local rewrites.

Source

pub fn run(&self, idx: &StructuralIndex, bytes: &[u8]) -> Bitmap

Run the plan against a StructuralIndex + bytes.

Trait Implementations§

Source§

impl Clone for OpPlan

Source§

fn clone(&self) -> OpPlan

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for OpPlan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OpPlan

Source§

fn default() -> OpPlan

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.