pub struct Split { /* private fields */ }Expand description
A GnuCash Split - a single entry in a transaction.
A Split represents one side of a double-entry transaction, linking an amount to an account. Each Split has both an ‘amount’ (in the account’s commodity) and a ‘value’ (in the transaction’s currency).
Implementations§
Source§impl Split
impl Split
Sourcepub unsafe fn from_raw(ptr: *mut Split, owned: bool) -> Option<Self>
pub unsafe fn from_raw(ptr: *mut Split, owned: bool) -> Option<Self>
Creates a Split wrapper from a raw pointer.
§Safety
The pointer must be valid and point to a properly initialized Split.
Sourcepub fn set_account(&self, account: &Account)
pub fn set_account(&self, account: &Account)
Sets the account for this split.
Sourcepub fn transaction(&self) -> Option<Transaction>
pub fn transaction(&self) -> Option<Transaction>
Returns the parent transaction of this split.
Sourcepub fn set_transaction(&self, trans: &Transaction)
pub fn set_transaction(&self, trans: &Transaction)
Sets the parent transaction for this split.
Sourcepub fn action(&self) -> Option<String>
pub fn action(&self) -> Option<String>
Returns the split action (e.g., “Buy”, “Sell”, “Deposit”).
Sourcepub fn set_action(&self, action: &str)
pub fn set_action(&self, action: &str)
Sourcepub fn split_type(&self) -> Option<String>
pub fn split_type(&self) -> Option<String>
Returns the split type (“normal” or “stock-split”).
Sourcepub fn make_stock_split(&self)
pub fn make_stock_split(&self)
Marks this split as a stock split.
Sourcepub fn set_amount(&self, amount: Numeric)
pub fn set_amount(&self, amount: Numeric)
Sets the amount in the account’s commodity.
Returns the share price (value / amount).
Sets both share price and amount simultaneously.
Sourcepub fn noclosing_balance(&self) -> Numeric
pub fn noclosing_balance(&self) -> Numeric
Returns the running balance excluding closing transactions.
Sourcepub fn cleared_balance(&self) -> Numeric
pub fn cleared_balance(&self) -> Numeric
Returns the cleared balance (cleared + reconciled splits).
Sourcepub fn reconciled_balance(&self) -> Numeric
pub fn reconciled_balance(&self) -> Numeric
Returns the reconciled balance (only reconciled splits).
Sourcepub fn reconcile_state(&self) -> char
pub fn reconcile_state(&self) -> char
Returns the reconcile state (‘n’, ‘c’, ‘y’, ‘f’, ‘v’).
Sourcepub fn set_reconcile_state(&self, state: char)
pub fn set_reconcile_state(&self, state: char)
Sets the reconcile state.
Sourcepub fn date_reconciled(&self) -> i64
pub fn date_reconciled(&self) -> i64
Returns the date when this split was reconciled.
Sourcepub fn set_date_reconciled(&self, time: i64)
pub fn set_date_reconciled(&self, time: i64)
Sets the date when this split was reconciled.
Sourcepub fn is_reconciled(&self) -> bool
pub fn is_reconciled(&self) -> bool
Returns true if this split is reconciled.
Sourcepub fn is_cleared(&self) -> bool
pub fn is_cleared(&self) -> bool
Returns true if this split is cleared.
Sourcepub fn other_split(&self) -> Option<Split>
pub fn other_split(&self) -> Option<Split>
Returns the other split in a two-split transaction. Returns None if the transaction has more than two splits.
Sourcepub fn corr_account_full_name(&self) -> Option<String>
pub fn corr_account_full_name(&self) -> Option<String>
Returns the full name of the corresponding account.
Sourcepub fn corr_account_name(&self) -> Option<String>
pub fn corr_account_name(&self) -> Option<String>
Returns the name of the corresponding account.
Sourcepub fn corr_account_code(&self) -> Option<String>
pub fn corr_account_code(&self) -> Option<String>
Returns the code of the corresponding account.
Sourcepub fn void_former_amount(&self) -> Numeric
pub fn void_former_amount(&self) -> Numeric
Returns the original amount before voiding.
Sourcepub fn void_former_value(&self) -> Numeric
pub fn void_former_value(&self) -> Numeric
Returns the original value before voiding.
Sourcepub fn is_peer(&self, other: &Split) -> bool
pub fn is_peer(&self, other: &Split) -> bool
Returns true if the other split is a peer of this one.
Sourcepub fn add_peer(&self, other: &Split, timestamp: i64)
pub fn add_peer(&self, other: &Split, timestamp: i64)
Adds a peer split to this split’s lot-split list.
Sourcepub fn remove_peer(&self, other: &Split)
pub fn remove_peer(&self, other: &Split)
Removes a peer split from this split’s lot-split list.