pub struct Record {
pub id: String,
pub transaction: Transaction,
}
Expand description
Represents an entry in a check register
Fields§
§id: String
record identifier.
transaction: Transaction
the record’s transaction
Implementations§
source§impl Record
impl Record
sourcepub fn from(id: &str, transaction: Transaction) -> Record
pub fn from(id: &str, transaction: Transaction) -> Record
Create a record object with given values. If id is an empty String, an id will be generated for you.
Example
let record = Record::from("FF04C3DC-F0FE-472E-8737-0F4034C049F0", Transaction::from(Some("2021-7-8"), Some(1260 as u32), String::from("Sam Hill Credit Union"), String::from("Open Account"), OrderedFloat::<f64>(500 as f64), TransactionType::DEPOSIT, false).unwrap());
sourcepub fn from_file(f: &str) -> Result<Vec<Record>, String>
pub fn from_file(f: &str) -> Result<Vec<Record>, String>
load vector containing Records from a given file path. This method attempts to read a file containing record data, returning a vector if successful, but will give out an error if something goes wrong, either with loading the file or parsing it.
sourcepub fn from_string(s: &str) -> Record
pub fn from_string(s: &str) -> Record
create a record directly from a string.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Record
impl<'de> Deserialize<'de> for Record
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Record
impl Ord for Record
source§impl PartialEq for Record
impl PartialEq for Record
source§impl PartialOrd for Record
impl PartialOrd for Record
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Record
impl StructuralEq for Record
Auto Trait Implementations§
impl RefUnwindSafe for Record
impl Send for Record
impl Sync for Record
impl Unpin for Record
impl UnwindSafe for Record
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
Mutably borrows from an owned value. Read more