1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! Chunk trait defining the interface for PNA archive chunks.
use ;
/// A trait representing a chunk in a PNA archive.
///
/// A chunk is the basic unit of data storage in a PNA archive. Each chunk consists of:
/// - A length field (4 bytes)
/// - A chunk type (4 bytes)
/// - The chunk data (variable length)
/// - A CRC32 checksum (4 bytes)
///
/// This trait provides the basic interface for working with chunks in a PNA archive.
///
/// # Examples
///
/// ```
/// use libpna::{Chunk, ChunkType, RawChunk};
///
/// let chunk = RawChunk::from((ChunkType::FDAT, vec![1, 2, 3]));
/// assert_eq!(chunk.ty(), ChunkType::FDAT);
/// assert_eq!(chunk.length(), 3);
/// assert_eq!(chunk.data(), &[1, 2, 3]);
/// assert_eq!(chunk.crc(), 2776590148);
/// ```