From 1097a08c9158321d0d68be7f09ae361328429ed9 Mon Sep 17 00:00:00 2001 From: clizia Date: Tue, 12 Nov 2024 15:02:59 +0100 Subject: [PATCH] made some fields and methods public --- src/chunk.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/chunk.rs b/src/chunk.rs index 5049c08..6870c25 100644 --- a/src/chunk.rs +++ b/src/chunk.rs @@ -3,15 +3,15 @@ use crc::Crc; use crate::chunk_type::ChunkType; -struct Chunk { +pub struct Chunk { length: u32, - chunk_type: ChunkType, + pub chunk_type: ChunkType, chunk_data: Vec, - crc: u32, + pub crc: u32, } impl Chunk { - fn new(chunktype: ChunkType, data: Vec) -> Chunk { + pub fn new(chunktype: ChunkType, data: Vec) -> Chunk { let x25: Crc = Crc::::new(&crc::CRC_32_ISO_HDLC); let to_hash: Vec = chunktype @@ -35,7 +35,7 @@ impl Chunk { self.length } - fn chunk_type(&self) -> &ChunkType { + pub fn chunk_type(&self) -> &ChunkType { &self.chunk_type } @@ -47,7 +47,7 @@ impl Chunk { self.crc } - fn data_as_string(&self) -> Result { + pub fn data_as_string(&self) -> Result { let to_stringify: Vec = self.chunk_data.clone(); if self.length() == 0 { @@ -57,7 +57,7 @@ impl Chunk { } } - fn as_bytes(&self) -> Vec { + pub fn as_bytes(&self) -> Vec { let bytes: Vec = self.length() .to_be_bytes() .iter()