pub struct TransactionState {
pub transaction: Transaction,
pub splits: Vec<Split>,
pub transaction_tags: Vec<Tag>,
pub split_tags: Vec<(Uuid, Tag)>,
pub prices: Vec<Price>,
pub account_names: HashMap<Uuid, String>,
}Fields§
§transaction: Transaction§splits: Vec<Split>§prices: Vec<Price>§account_names: HashMap<Uuid, String>Display name per posting account id, so the serializer can expose
SPLIT-ACCOUNT-NAME to trigger scripts without an in-script account
lookup. Empty for an account whose name is unknown at build time.
Implementations§
Source§impl TransactionState
impl TransactionState
pub fn new(transaction: Transaction) -> Self
pub fn with_account_names(self, names: HashMap<Uuid, String>) -> Self
pub fn with(self, entities: Vec<FinanceEntity>) -> Self
pub fn with_note(self, note: Option<String>) -> Self
Sourcepub fn run_scripts(
self,
executor: &ScriptExecutor,
scripts: &[(Uuid, Vec<u8>)],
) -> Result<ScriptRunReport, ServerError>
pub fn run_scripts( self, executor: &ScriptExecutor, scripts: &[(Uuid, Vec<u8>)], ) -> Result<ScriptRunReport, ServerError>
Runs each script against the current state, accumulating
per-script failures into a structured ScriptRunReport rather
than swallowing them silently. The state field reflects every
script that successfully produced entities; failed scripts are
recorded in failures and don’t abort the batch — subsequent
scripts still observe state mutations from earlier successes.
The outer Result reserves ServerError for genuine
orchestration failures (entity-apply errors), keeping
script-side failures structurally separate. Callers that want
the previous “first-failure-aborts” semantics can chain with
ScriptRunReport::into_state_or_first_failure.
Auto Trait Implementations§
impl Freeze for TransactionState
impl RefUnwindSafe for TransactionState
impl Send for TransactionState
impl Sync for TransactionState
impl Unpin for TransactionState
impl UnsafeUnpin for TransactionState
impl UnwindSafe for TransactionState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more