You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I actually came across another usecase for passing around a Vec<u8>. I want to create a trait method which returns the result of record(). This doesn't seem directly possible due to impl Trait not being a valid return value. I figure I should be able to pass the output of RecordBuilder::store() to add_record_raw by replicating this logic here? https://github.com/njaard/sonnerie/blob/172c301950cdde42bd70bd44b3c6d58373410fc1/src/write.rs#L227C1-L251C5
Or actually just
buf.write_u64::<BigEndian>(1.1e18 as u64).unwrap();
record.store(&mut buf);
should be enough?
njaard
changed the title
add_record_raw has poor documention, may not be unusable
add_record_raw has poor documention, may not be usable
Dec 18, 2023
Yes to replicating the logic in that function you linked to.
Just storing that 1.1e18 (to represent the timestamp?) isn't enough in the case of storing strings as a payload, because Strings are variable-length encoding.
You can see the length of the entire record is stored as a varint in that case
I had problems with it myself in #28
The text was updated successfully, but these errors were encountered: