pub fn update(&mut self, record: Record<T>) -> Result<(), Error> {
        self.records.insert(record.id.clone(), record.clone());
        let write_res = match serde_json::to_string(&record) {
            Ok(rec_str) => self
                .writer
                .write_fmt(format_args!("{}\n", rec_str.as_str()))
                .map_err(Error::IOError),
            Err(err) => Err(Error::JSONStringError(err)),
        };

        match write_res {
            Ok(_) => Ok(()),
            Err(err) => Err(err),
        }
    }
/// Update an existing record. The `UniqueId` of the record passed into this function must match
/// the `UniqueId` of a record already in the database.
Update an existing record. The `UniqueId` of the record passed into this function must match
the `UniqueId` of a record already in the database.
Update an existing record . The ` UniqueId ` of the record passed into this function must match the ` UniqueId ` of a record already in the database .
pub fn update(&mut self, record: Record<T>) -> Result<(), Error> {
        self.records.insert(record.id.clone(), record.clone());
        let write_res = match serde_json::to_string(&record) {
            Ok(rec_str) => self
                .writer
                .write_fmt(format_args!("{}\n", rec_str.as_str()))
                .map_err(Error::IOError),
            Err(err) => Err(Error::JSONStringError(err)),
        };
        match write_res {
            Ok(_) => Ok(()),
            Err(err) => Err(err),
        }
    }
pub fn update ( & mut self , record : Record < T > ) -> Result < ( ) , Error > { self . records . insert ( record . id . clone ( ) , record . clone ( ) ) ; let write_res = match serde_json :: to_string ( & record ) { Ok ( rec_str ) => self . writer . write_fmt ( format_args ! ( " \n " rec_str as_str ( ) ) ) . map_err ( Error :: IOError ) , Err ( err ) => Err ( Error :: JSONStringError ( err ) ) , } ; match write_res { Ok ( _ ) => Ok ( ( ) ) , Err ( err ) => Err ( err ) , } }
Update an existing record.
Update an existing record .
&mut self
record
Record<T>
&mut self
record
Record<T>