pub struct FieldRule {
pub selector: Selector,
pub mode: ExtractMode,
pub keys: Vec<String>,
pub exclude_keys: Vec<String>,
pub prefix: String,
pub prefix_keys: HashMap<String, String>,
pub max_depth: usize,
}Expand description
One text source within a document.
Fields§
§selector: SelectorWhat this rule selects. See Selector.
mode: ExtractModeHow the selected nodes are turned into text. See ExtractMode.
keys: Vec<String>Object keys whose string values are indexed. Empty means every key — the
pre-keys behaviour.
Strings not under any object key are always indexed: elements of the
selected array, and the selected node when it is itself a string. Nothing
names them, so an allowlist has nothing to match — without this, setting
keys would lose notillo’s plainest text (a bare CompactInlineContent
string) and every string-selecting rule such as pr.caption.
This is not the mirror of exclude_keys: that prunes a subtree, this
gates a leaf. Containers are always descended, so a document with dynamic
keys (calcillo’s rows.<rowId>.<colId>) still reaches its text. It cannot
separate the members of a positional tuple like ["Hi", "b"] — both carry
the same enclosing key — unless the part rule deletes one first; see
PartRule::prune. Only meaningful for ExtractMode::Text.
exclude_keys: Vec<String>Object keys whose values are skipped entirely (link targets, colors…).
Only meaningful for ExtractMode::Text.
prefix: StringConstant prefix on every token this rule emits, e.g. "#" on a rule
selecting tag values. Unlike prefix_keys it survives ExtractMode::String
and a JSONPath selector that lands on the value itself, where there is no
key left to match.
prefix_keys: HashMap<String, String>Object keys whose string values get a prefix — e.g. {"tg": "#"} turns
a tag node’s text into a #tag token.
max_depth: usizeImplementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FieldRule
impl RefUnwindSafe for FieldRule
impl Send for FieldRule
impl Sync for FieldRule
impl Unpin for FieldRule
impl UnsafeUnpin for FieldRule
impl UnwindSafe for FieldRule
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more