Skip to main content

LiveInput

Struct LiveInput 

Source
pub struct LiveInput<'a> {
    pub caret_and_selection: Option<&'a Highlight>,
    pub live: Option<&'a LiveState<'a>>,
    pub substitute: Option<Substitute<'a>>,
    pub appearance_state: Option<&'a [u8]>,
}
Expand description

What a form session shows a widget it is editing, beyond the widget’s own dictionary.

Three borrows that travel together because the live path needs all three to draw one field: the overlay it paints, the text it paints instead of the stored /V, and the second face for the characters the /DA font cannot write. A record rather than three more parameters, so a fourth answer can be added without moving anyone’s call.

Default is “a field with nothing live about it”, which generate_with_live_faces renders exactly as generate_with_text does with no substitute. Adding a field to this struct breaks every exhaustive literal outside this crate. #[non_exhaustive] is NOT the fix: it forbids the literal form entirely outside the crate, ..Default::default() included (E0639), and the two external callers (pdfrum-form::route, pdfrum-tool::chrome) legitimately build the whole value. Before a fourth field lands, give it a constructor — LiveInput::new() plus with_* setters — and convert those two sites; that keeps additions source-compatible without taking literal construction away.

Fields§

§caret_and_selection: Option<&'a Highlight>

The focused-field caret and selection bands.

§live: Option<&'a LiveState<'a>>

What the session is showing in place of the stored /V, /I and /TI.

§substitute: Option<Substitute<'a>>

The second face, for characters the /DA font’s charset does not cover. None leaves every character to the /DA font, which is what a Hebrew value being typed into a Latin field used to get: the low byte of each code point, drawn as Latin.

§appearance_state: Option<&'a [u8]>

The appearance state a session is showing, overriding the widget dictionary’s own /AS. None reads /AS as before, byte for byte.

§Why a session cannot say this through /AS

A radio group is one field with several kid controls, and each kid carries a different on-state name in its own /AP /N. Checking one sets the clicked control’s /AS to that control’s own on-state and every other control’s to Off — so one click restates the state of every kid in the group, in as many different names.

A session holds one state record per field, so all it can say is which control the click chose. Turning that into what each kid draws is per-kid, and the widget dictionary on disk still names the state before the click. This is how the session tells the generator which kid to draw off — the value it passes being Off for a sibling and the control’s own on-state for the chosen one.

Only the on/off question is overridden, not the state’s name: what the generator does with it is is_checked_with’s single comparison against Off, so any non-Off bytes draw the on-state shape.

Trait Implementations§

Source§

impl<'a> Clone for LiveInput<'a>

Source§

fn clone(&self) -> LiveInput<'a>

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<'a> Copy for LiveInput<'a>

Source§

impl<'a> Debug for LiveInput<'a>

Source§

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

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

impl<'a> Default for LiveInput<'a>

Source§

fn default() -> LiveInput<'a>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for LiveInput<'a>

§

impl<'a> RefUnwindSafe for LiveInput<'a>

§

impl<'a> Send for LiveInput<'a>

§

impl<'a> Sync for LiveInput<'a>

§

impl<'a> Unpin for LiveInput<'a>

§

impl<'a> UnsafeUnpin for LiveInput<'a>

§

impl<'a> UnwindSafe for LiveInput<'a>

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.