/// Make log entry from serializable source
///
/// Returns bytes buffer, filled with header (currently only with entry size) and serialized entry, without any offset between each other.
/// ```
/// +---------+
/// |Entry len|
/// +---------+
/// |         |
/// |  Entry  |
/// |         |
/// +---------+
/// ```
Make log entry from serializable source
Returns bytes buffer, filled with header (currently only with entry size) and serialized entry, without any offset between each other.
Make log entry from serializable source Returns bytes buffer filled with header ( currently only with entry size ) and serialized entry without any offset between each other .
fn make_log_entry<S>(source: &S) -> Result<Vec<u8>, PersistenceError>
    where
        S: Serialize,
    {
        let size = serialized_size(source).map_err(PersistenceError::SerializationError)?;
        debug!("Log entry size: {}", size);
        let capacity = size_of::<u64>()
            + TryInto::<usize>::try_into(size).map_err(PersistenceError::LogEntryTooBig)?;
        let mut buf = Vec::with_capacity(capacity);
        buf.extend(&size.to_le_bytes());
        buf.resize(capacity, 0);
        serialize_into(&mut buf[size_of::<u64>()..], source)
            .map_err(PersistenceError::SerializationError)?;
        Ok(buf)
    }
fn make_log_entry < S > ( source : & S ) -> Result < Vec < u8 > , PersistenceError > where S : Serialize , { let size = serialized_size ( source ) . map_err ( PersistenceError :: SerializationError ) ? ; debug ! ( " " size ) ; let capacity = size_of :: < u64 > ( ) + TryInto :: < usize > :: try_into ( size ) . map_err ( PersistenceError :: LogEntryTooBig ) ? ; let mut buf = Vec :: with_capacity ( capacity ) ; buf . extend ( & size . to_le_bytes ( ) ) ; buf . resize ( capacity , 0 ) ; serialize_into ( & mut buf [ size_of :: < u64 > ( ) .. ] , source ) . map_err ( PersistenceError :: SerializationError ) ? ; Ok ( buf ) }
Make log entry from serializable source
Returns bytes buffer, filled with header (currently only with entry size) and serialized entry, without any offset between each other.
Make log entry from serializable source Returns bytes buffer filled with header ( currently only with entry size ) and serialized entry without any offset between each other .
source
&S