Closed ScanMountGoat closed 3 years ago
#[cfg_attr(feature = "derive_serde", derive(Serialize, Deserialize))]
#[derive(BinRead, Debug, SsbhWrite)]
pub struct SsbhString4{
value: RelPtr64<NullString4>
}
#[cfg_attr(feature = "derive_serde", derive(Serialize, Deserialize))]
#[derive(BinRead, Debug, SsbhWrite)]
pub struct SsbhString8{
value: RelPtr64<NullString8>
}
#[cfg_attr(feature = "derive_serde", derive(Serialize, Deserialize))]
#[derive(BinRead, Debug, SsbhWrite)]
pub struct NullString4 {
// NullString
}
#[cfg_attr(feature = "derive_serde", derive(Serialize, Deserialize))]
#[derive(BinRead, Debug, SsbhWrite)]
pub struct NullString8 {
// NullString
}
The internal string representation is an implementation detail and can just be exposed as a getter function
fn text(&self) -> &str
orfn text(&self) -> &str
. Having separate types for 4 and 8 byte alignment should reduce the amount of repeated code for implementing SsbhWrite.