From 8cedbaf13d3588dbcf7ef8474872879fdbb77a53 Mon Sep 17 00:00:00 2001 From: clizia Date: Mon, 11 Nov 2024 13:33:24 +0100 Subject: [PATCH] cleaned chunk_type.rs --- src/chunk_type.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/chunk_type.rs b/src/chunk_type.rs index 41d013b..84777a5 100644 --- a/src/chunk_type.rs +++ b/src/chunk_type.rs @@ -1,5 +1,5 @@ use core::str; -use std::{str::FromStr, u8}; +use std::str::FromStr; fn byte_to_bits(byte: u8) -> [u8; 8] { let mut bits = [0u8; 8]; @@ -27,7 +27,7 @@ pub struct ChunkType { impl ChunkType { - fn bytes(&self) -> [u8; 4] { + pub fn bytes(&self) -> [u8; 4] { let bytes: [u8; 4] = [ self.ancillary_byte, self.private_byte, @@ -58,7 +58,6 @@ impl ChunkType { continue; } } - } @@ -68,12 +67,10 @@ impl ChunkType { fn is_public(&self) -> bool { self.private_byte.is_ascii_uppercase() - } fn is_reserved_bit_valid(&self) -> bool { self.reserved_byte.is_ascii_uppercase() - } fn is_safe_to_copy(&self) -> bool { @@ -86,7 +83,6 @@ impl TryFrom<[u8; 4]> for ChunkType { type Error = &'static str; fn try_from(value: [u8; 4]) -> Result { - let chunk_type = ChunkType { ancillary_byte: value[0], private_byte: value[1], @@ -107,7 +103,6 @@ impl TryFrom<[u8; 4]> for ChunkType { continue; } } - } } @@ -122,7 +117,6 @@ impl std::fmt::Display for ChunkType { write!(f, "{}", s) } - } impl FromStr for ChunkType { @@ -151,7 +145,6 @@ impl FromStr for ChunkType { continue; } } - } }