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>,
}
Expand description

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

Fields§

§nodes: Vec<FormNode>§metadata: Vec<FormNodeMeta>

Per-node metadata (parallel to nodes).

§node_ids: HashMap<String, FormNodeId>

Lookup table: XFA id attribute -> FormNodeId.

Implementations§

Source§

impl FormTree

Source

pub fn new() -> Self

Source

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

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

Source

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

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

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

impl Default for FormTree

Source§

fn default() -> Self

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, 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, 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.