Add pass flushing for move money
This commit is contained in:
10
src/lib.rs
10
src/lib.rs
@@ -14,10 +14,14 @@ pub use self::overhead_allocation::*;
|
||||
mod create_products;
|
||||
pub use self::create_products::*;
|
||||
|
||||
mod shared_models;
|
||||
pub use self::shared_models::*;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn move_money_from_text(
|
||||
rules: *const c_char,
|
||||
lines: *const c_char,
|
||||
accounts: *const c_char,
|
||||
use_numeric_accounts: bool,
|
||||
) -> *mut c_char {
|
||||
let mut output_writer = csv::Writer::from_writer(vec![]);
|
||||
@@ -29,11 +33,17 @@ pub extern "C" fn move_money_from_text(
|
||||
assert!(!lines.is_null());
|
||||
CStr::from_ptr(lines)
|
||||
};
|
||||
let safe_accounts = unsafe {
|
||||
assert!(!lines.is_null());
|
||||
CStr::from_ptr(accounts)
|
||||
};
|
||||
move_money(
|
||||
csv::Reader::from_reader(safe_rules.to_bytes()),
|
||||
csv::Reader::from_reader(safe_lines.to_bytes()),
|
||||
csv::Reader::from_reader(safe_accounts.to_bytes()),
|
||||
&mut output_writer,
|
||||
use_numeric_accounts,
|
||||
true,
|
||||
);
|
||||
// TODO: Replace all these unwraps with something more elegant
|
||||
let inner = output_writer.into_inner().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user