Skip to main content

FormTree

Struct FormTree 

Source
pub struct FormTree {
    pub nodes: Vec<FormNode>,
    pub metadata: Vec<FormNodeMeta>,
    pub node_ids: HashMap<String, FormNodeId>,
    pub variables_scripts: Vec<(Option<String>, String, String)>,
    pub any_data_bound: bool,
}
Expand description

The form tree: a node-based representation of the merged template+data.

Fields§

§nodes: Vec<FormNode>

Nodes in the form tree.

§metadata: Vec<FormNodeMeta>

Per-node metadata (parallel to nodes).

§node_ids: HashMap<String, FormNodeId>

Lookup table: XFA id attribute -> FormNodeId.

§variables_scripts: Vec<(Option<String>, String, String)>

XFA 3.3 §5.5 <variables> <script name="X">…</script> blocks gathered at merge time. Each entry is (subform_scope, name, body). subform_scope is None for root-level scripts (globally accessible) and Some(subform_name) for scripts scoped to a named subform (accessible as subform.variables.scriptName). Empty in default mode.

§any_data_bound: bool

True when the merger bound at least one field value from the DataDom. False for forms whose datasets contain only server-infrastructure metadata with no template-field bindings. Used by the flatten pipeline to gate data-empty page suppression: pages must not be suppressed when no data binding has occurred (all field values come from template defaults).

Implementations§

Source§

impl FormTree

Source

pub fn new() -> FormTree

Create a new form tree.

Source

pub fn add_node(&mut self, node: FormNode) -> FormNodeId

Add a node to the form tree.

Source

pub fn add_node_with_meta( &mut self, node: FormNode, meta: FormNodeMeta, ) -> FormNodeId

Add a node together with its metadata. If the meta has an xfa_id, it is registered in the node_ids lookup table.

Source

pub fn get(&self, id: FormNodeId) -> &FormNode

Get a node by ID.

Source

pub fn get_mut(&mut self, id: FormNodeId) -> &mut FormNode

Get a mutable reference to a node by ID.

Source

pub fn meta(&self, id: FormNodeId) -> &FormNodeMeta

Access the metadata for a node.

Source

pub fn meta_mut(&mut self, id: FormNodeId) -> &mut FormNodeMeta

Mutably access the metadata for a node.

Source

pub fn find_by_xfa_id(&self, id: &str) -> Option<FormNodeId>

Look up a node by its XFA id attribute.

Trait Implementations§

Source§

impl Debug for FormTree

Source§

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

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

impl Default for FormTree

Source§

fn default() -> FormTree

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,