Skip to main content

NodeMatchContext

Struct NodeMatchContext 

Source
pub(crate) struct NodeMatchContext<'a> {
    pub is_disabled: bool,
    pub type_index: Option<usize>,
    pub type_count: Option<usize>,
    pub own_siblings: Option<&'a [Node]>,
}
Expand description

1 ノードに対して一度だけ計算すればよい照合用の前提情報。

【2026-07-27 性能修正】従来これらは matches_selector の内部で ルールごとに毎回計算されていた。実サイト規模(2403 ルール × 365 ノード = 約 88 万回)では、祖先を辿る is_node_disabled と兄弟を数える type_sibling_position が支配的なコストになり、1 回のカスケードに 約 46 秒を要していた。ノード単位で 1 回計算して使い回す。

Fields§

§is_disabled: bool§type_index: Option<usize>§type_count: Option<usize>§own_siblings: Option<&'a [Node]>

Implementations§

Source§

impl<'a> NodeMatchContext<'a>

Source

pub fn new( current: &Node, ancestors: &'a [AncestorContext<'a>], sibling_index: Option<usize>, ) -> Self

Auto Trait Implementations§

§

impl<'a> Freeze for NodeMatchContext<'a>

§

impl<'a> RefUnwindSafe for NodeMatchContext<'a>

§

impl<'a> Send for NodeMatchContext<'a>

§

impl<'a> Sync for NodeMatchContext<'a>

§

impl<'a> Unpin for NodeMatchContext<'a>

§

impl<'a> UnsafeUnpin for NodeMatchContext<'a>

§

impl<'a> UnwindSafe for NodeMatchContext<'a>

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.