pub fn default_on_eof<'de, T, D>(d: D) -> Result<T, D::Error>
where
    D: Deserializer<'de>,
    T: Deserialize<'de> + Default,
{
    let result = T::deserialize(d);
    match result {
        Err(err) if err.to_string() == "io error: unexpected end of file" => Ok(T::default()),
        result => result,
    }
}
/// This helper function enables successful deserialization of versioned structs; new structs may
/// include additional fields if they impl Default and are added to the end of the struct. Right
/// now, this function is targeted at `bincode` deserialization; the error match may need to be
/// updated if another package needs to be used in the future.
This helper function enables successful deserialization of versioned structs; new structs may
include additional fields if they impl Default and are added to the end of the struct. Right
now, this function is targeted at `bincode` deserialization; the error match may need to be
updated if another package needs to be used in the future.
This helper function enables successful deserialization of versioned structs ; new structs may include additional fields if they impl Default and are added to the end of the struct . Right now this function is targeted at ` bincode ` deserialization ; the error match may need to be updated if another package needs to be used in the future .
pub fn default_on_eof<'de, T, D>(d: D) -> Result<T, D::Error>
where
    D: Deserializer<'de>,
    T: Deserialize<'de> + Default,
{
    let result = T::deserialize(d);
    match result {
        Err(err) if err.to_string() == "io error: unexpected end of file" => Ok(T::default()),
        result => result,
    }
}
pub fn default_on_eof < ' de , T , D > ( d : D ) -> Result < T , D :: Error > where D : Deserializer < ' de > , T : Deserialize < ' de > + Default , { let result = T :: deserialize ( d ) ; match result { Err ( err ) if err . to_string ( ) == " " => Ok ( T :: default ( ) ) , result => result , } }
This helper function enables successful deserialization of versioned structs; new structs may
include additional fields if they impl Default and are added to the end of the struct.
This helper function enables successful deserialization of versioned structs ; new structs may include additional fields if they impl Default and are added to the end of the struct .
d
D