Skip to main content

FormBatch

Struct FormBatch 

Source
pub struct FormBatch {
    pub payer_tins: TinBuffer,
    pub recipient_tins: TinBuffer,
    pub interest_income: AmountBuffer,
    pub tax_years: Vec<u16>,
    /* private fields */
}
Expand description

Batch of tax forms for validation.

Uses Structure of Arrays (SoA) layout for cache efficiency.

Fields§

§payer_tins: TinBuffer

Payer TINs

§recipient_tins: TinBuffer

Recipient TINs

§interest_income: AmountBuffer

Interest income amounts (cents)

§tax_years: Vec<u16>

Tax year (stored as u16)

Implementations§

Source§

impl FormBatch

Source

pub fn with_capacity(capacity: usize) -> Self

Create a new batch with given capacity.

Source

pub fn with_config(capacity: usize, config: ValidationConfig) -> Self

Create a batch with custom configuration.

Source

pub fn clear(&mut self)

Clear the batch for reuse.

Source

pub fn len(&self) -> usize

Get the number of forms in the batch.

Source

pub fn is_empty(&self) -> bool

Check if the batch is empty.

Source

pub fn push_tins(&mut self, payer_tin: &str, recipient_tin: &str)

Push TINs for a form.

Source

pub fn push_income(&mut self, cents: i64)

Push an interest income amount.

Source

pub fn push_tax_year(&mut self, year: u16)

Push a tax year.

Source

pub fn validate(&self) -> BatchResult

Validate all forms in the batch.

Returns a BatchResult with validation flags for each form.

Source

pub fn validate_tins_only(&self) -> BatchResult

Validate TINs only (faster if you only need TIN validation).

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.