// Copyright (c) 2025-present, fjall-rs
// This source code is licensed under both the Apache 2.0 and MIT License
// (found in the LICENSE-* files in the repository)
usecrate::sfa::checksum::Checksum;usebyteorder::WriteBytesExt;pubconstTRAILER_MAGIC:&[u8]=b"SFA!";pubstructTrailerWriter;implTrailerWriter{pubfnwrite_into<W:std::io::Write>(mutwriter: W,
toc_checksum: Checksum,
toc_pos:u64,
toc_len:u64,
)->crate::sfa::Result<()>{usebyteorder::LE;log::trace!("Writing trailer");
writer.write_all(TRAILER_MAGIC)?;
writer.write_u8(0x1)?;// Version
writer.write_u8(0x0)?;// Checksum type, xxh3 = 0x0
writer.write_u128::<LE>(toc_checksum.into_u128())?;
writer.write_u64::<LE>(toc_pos)?;
writer.write_u64::<LE>(toc_len)?;Ok(())}}