acroform/types.rs
1//! Type definitions for AcroForm values
2
3use std::fmt;
4
5/// Represents a value that can be assigned to a form field
6#[derive(Debug, Clone, PartialEq)]
7pub enum FieldValue {
8 /// Text value (for text fields)
9 Text(String),
10 /// Boolean value (for checkboxes)
11 Boolean(bool),
12 /// Choice value (for radio buttons and dropdowns)
13 Choice(String),
14 /// Integer value (for numeric fields)
15 Integer(i32),
16}
17
18impl fmt::Display for FieldValue {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 match self {
21 FieldValue::Text(s) => write!(f, "{}", s),
22 FieldValue::Boolean(b) => write!(f, "{}", b),
23 FieldValue::Choice(s) => write!(f, "{}", s),
24 FieldValue::Integer(i) => write!(f, "{}", i),
25 }
26 }
27}