Skip to main content

FormField

Struct FormField 

Source
pub struct FormField {
Show 23 fields pub object: ObjRef, pub parent: Option<ObjRef>, pub kids: Vec<ObjRef>, pub widgets: Vec<Widget>, pub field_type: Option<FieldType>, pub partial_name: Option<String>, pub name: String, pub alternate_name: Option<String>, pub mapping_name: Option<String>, pub flags: FieldFlags, pub value: Option<Object>, pub default_value: Option<Object>, pub default_appearance: Option<String>, pub quadding: Quadding, pub default_style: Option<String>, pub rich_text: Option<String>, pub max_len: Option<u32>, pub options: Vec<ChoiceOption>, pub top_index: u32, pub selected_indices: Vec<u32>, pub additional_actions: Option<Dict>, pub lock: Option<ObjRef>, pub seed_value: Option<ObjRef>,
}
Expand description

One field dictionary (ISO 32000-1 §12.7.3, Table 220) with the inheritable entries taken from the nearest ancestor that has them.

Fields§

§object: ObjRef

The field dictionary’s own reference.

§parent: Option<ObjRef>

/Parent: the field whose /Kids holds this one, as walked; None for a root field.

§kids: Vec<ObjRef>

The /Kids that are fields themselves, in array order.

§widgets: Vec<Widget>

The widget annotations that draw this field: the /Kids that are /Subtype /Widget dictionaries without a /T of their own, or the field itself when its single widget is merged into it.

§field_type: Option<FieldType>

/FT, inherited; None for a non-terminal field that names none and for a name Table 220 does not list.

§partial_name: Option<String>

/T: the partial field name (§12.7.3.2).

§name: String

The fully qualified field name (§12.7.3.2): the partial names from the root field down, joined by a period; a field without a /T shares its parent’s name, and a root without one has the empty name.

§alternate_name: Option<String>

/TU: the name shown to the user in place of the field name.

§mapping_name: Option<String>

/TM: the name used when the field’s data is exported.

§flags: FieldFlags

/Ff, inherited; no bit set by default.

§value: Option<Object>

/V, inherited, resolved one level, in the format of the field’s type; a merged widget’s own value beats its parent’s.

§default_value: Option<Object>

/DV, inherited, resolved one level: the value a reset-form action restores.

§default_appearance: Option<String>

/DA, inherited (§12.7.3.3, Table 222): the default appearance string of a variable text field, the interactive form’s document-wide /DA when neither the field nor an ancestor has one; what it sets reads through DefaultAppearance::parse.

§quadding: Quadding

/Q, inherited (§12.7.3.3, Table 222): how a variable text field’s text is justified, the interactive form’s document-wide /Q when neither the field nor an ancestor has one, left-justified when none does or the value is not 0, 1 or 2.

§default_style: Option<String>

/DS (§12.7.3.3, Table 222): the default style string rich text is laid out with (§12.7.3.4).

§rich_text: Option<String>

/RV (§12.7.3.3, Table 222): the rich text value as text, a text stream read into a string; its markup is not parsed (§12.7.3.4).

§max_len: Option<u32>

/MaxLen, inherited (§12.7.4.3, Table 229): the most characters a text field’s text may hold.

§options: Vec<ChoiceOption>

/Opt, inherited: the options of a choice field (§12.7.4.4, Table 231) or the export values of a check box or radio button (§12.7.4.2, Table 227); an entry that is neither a text string nor a pair of them is skipped.

§top_index: u32

/TI (§12.7.4.4): the index into options of the first option a scrollable list box shows; 0 by default.

§selected_indices: Vec<u32>

/I (§12.7.4.4): the indices into options of the selected options of a multi-select choice field, as written.

§additional_actions: Option<Dict>

/AA: the field’s additional-actions dictionary, as written.

§lock: Option<ObjRef>

/Lock (§12.7.4.5, Table 232): the signature field lock dictionary naming the fields that lock once this field is signed, by reference.

§seed_value: Option<ObjRef>

/SV (§12.7.4.5, Table 232): the seed value dictionary constraining a signature applied to this field, by reference.

Implementations§

Source§

impl FormField

Source

pub fn text(&self) -> Option<String>

The text of a text field (ISO 32000-1 §12.7.4.3): /V decoded as a text string. None for a field of another type or without a value.

Source

pub fn button_kind(&self) -> Option<ButtonKind>

Which kind of button a button field is (ISO 32000-1 §12.7.4.2, Table 226): a pushbutton when the Pushbutton flag is set, radio buttons when Radio is set, a check box otherwise. None for a field of another type.

Source

pub fn state(&self) -> Option<&str>

The appearance state a check box or radio button field is in (ISO 32000-1 §12.7.4.2): /V as a name, the one the widgets’ /AP /N dictionaries key their on and off appearances by, Off when there is no value (§12.7.4.2.4’s default). None for a pushbutton, which keeps no value, for another field type, and for a value that is no name.

Source

pub fn checked(&self) -> Option<bool>

Whether a check box is checked (ISO 32000-1 §12.7.4.2.3): its state is a name other than Off; an absent value is the off state. None for a field that is no check box.

Source

pub fn on_widgets(&self) -> Vec<usize>

The widgets of a check box or radio button field that are in the on state (ISO 32000-1 §12.7.4.2.3, §12.7.4.2.4): those whose on state is the field’s state, as indices into widgets. The same indices pick the Table 227 export values out of options. Empty for a field in the off state, a pushbutton, or another field type.

Source

pub fn signature(&self) -> Option<Signature>

The signature a signature field holds (ISO 32000-1 §12.7.4.5): its /V read as a signature dictionary. None for another field type, an unsigned field, or a value that is no dictionary.

Source

pub fn selected(&self) -> Vec<String>

The names of a choice field’s selected options (ISO 32000-1 §12.7.4.4): /V as one text string or, for a multi-select field, an array of them. Empty for a field of another type, without a value, or whose value is neither.

Trait Implementations§

Source§

impl Clone for FormField

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FormField

Source§

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

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

impl PartialEq for FormField

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FormField

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.