db(+async) writer: add push_by_ref
This commit is contained in:
parent
9196c61a12
commit
5ed0398203
@ -84,6 +84,10 @@ where
|
||||
}
|
||||
|
||||
pub async fn push(&mut self, item: T) -> Result<(), String> {
|
||||
self.push_by_ref(&item).await
|
||||
}
|
||||
|
||||
pub async fn push_by_ref(&mut self, item: &T) -> Result<(), String> {
|
||||
let pos: LSize = self.data_buf.len() as LSize;
|
||||
|
||||
bincode::encode_into_writer(item, &mut self.cur_buf_item, BINCODE_CFG).str_err()?;
|
||||
|
@ -77,6 +77,10 @@ where
|
||||
}
|
||||
|
||||
pub fn push(&mut self, item: T) -> Result<(), String> {
|
||||
self.push_by_ref(&item)
|
||||
}
|
||||
|
||||
pub fn push_by_ref(&mut self, item: &T) -> Result<(), String> {
|
||||
let pos: LSize = self.data_buf.position() as LSize;
|
||||
|
||||
bincode::encode_into_writer(item, &mut self.cur_buf_item, BINCODE_CFG).str_err()?;
|
||||
|
Loading…
Reference in New Issue
Block a user