tynavi 0.1.3

An immutable selector library for navigating, filtering, and backtracking through deeply nested Rust data structures.
Documentation
use crate::selector::Selector;

pub trait Snapshot {
	fn snapshot(&self) -> Self;
}

pub trait AsSelector<'a, C: ?Sized, P: SelectorInstance> {
	fn as_selector(&'a self) -> Selector<'a, C, P>;
}

impl Snapshot for () {
	fn snapshot(&self) -> Self {}
}

pub trait Unmatch {
	fn unmatch(&self) -> Self;
	fn cond_unmatch(&self, condition: bool) -> Self;
}

impl Unmatch for () {
	fn unmatch(&self) -> Self {}

	fn cond_unmatch(&self, _: bool) -> Self {}
}

pub trait SelectorInstance: Snapshot + Unmatch + Copy {}

impl<T: Snapshot + Unmatch + Copy> SelectorInstance for T {}