Created
December 2, 2021 19:33
-
-
Save tobz/b6f951bd54adc7d9a1aa872635b06b2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Archive, Serialize, Debug)] | |
pub struct Record<'a> { | |
/// The checksum of the record. | |
/// | |
/// The checksum is CRC32C(big_endian_bytes(id) + payload). | |
pub(super) checksum: u32, | |
/// The record ID. | |
/// | |
/// This is monotonic across records. | |
id: u64, | |
// The record length. | |
// | |
// This is the number of bytes that follow the header. | |
#[with(CopyOptimize, RefAsBox)] | |
payload: &'a [u8], | |
} | |
#[rustc_layout(debug)] | |
#[repr(transparent)] | |
struct DebugArchivedRecord<'a>(ArchivedRecord<'a>); | |
layout_of(disk_v2::record::DebugArchivedRecord) = Layout { | |
fields: Arbitrary { | |
offsets: [ | |
Size { | |
raw: 0, | |
}, | |
], | |
memory_index: [ | |
0, | |
], | |
}, | |
variants: Single { | |
index: 0, | |
}, | |
abi: Aggregate { | |
sized: true, | |
}, | |
largest_niche: None, | |
align: AbiAndPrefAlign { | |
abi: Align { | |
pow2: 3, | |
}, | |
pref: Align { | |
pow2: 3, | |
}, | |
}, | |
size: Size { | |
raw: 24, | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment