#![allow(unused_variables)]
fn main() {
use std::convert::TryFrom;
use std::fmt;
use std::str::FromStr;
use crate::{Error, Result};
/// A validated PNG chunk type. See the PNG spec for more details.
/// http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ChunkType {
// Write me!
}
impl ChunkType {
/// Returns the raw bytes contained in this chunk
pub fn bytes(&self) -> [u8; 4] {
todo!()
}
/// Returns the property state of the first byte as described in the PNG spec
pub fn is_critical(&self) -> bool {
todo!()
}
/// Returns the property state of the second byte as described in the PNG spec
pub fn is_public(&self) -> bool {
todo!()
}
/// Returns the property state of the third byte as described in the PNG spec
pub fn is_reserved_bit_valid(&self) -> bool {
todo!()
}
/// Returns the property state of the fourth byte as described in the PNG spec
pub fn is_safe_to_copy(&self) -> bool {
todo!()
}
/// Returns true if the reserved byte is valid and all four bytes are represented by the characters A-Z or a-z.
/// Note that this chunk type should always be valid as it is validated during construction.
pub fn is_valid(&self) -> bool {
todo!()
}
/// Valid bytes are represented by the characters A-Z or a-z
pub fn is_valid_byte(byte: u8) -> bool {
todo!()
}
}
impl TryFrom<[u8; 4]> for ChunkType {
type Error = Error;
fn try_from(bytes: [u8; 4]) -> Result<Self> {
todo!()
}
}
impl fmt::Display for ChunkType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
todo!()
}
}
impl FromStr for ChunkType {
type Err = Error;
fn from_str(s: &str) -> Result<Self> {
todo!()
}
}
}