| 1 | /* |
| 2 | * Copyright (c) 2023. |
| 3 | * |
| 4 | * This software is free software; You can redistribute it or modify it under terms of the MIT, Apache License or Zlib license |
| 5 | */ |
| 6 | |
| 7 | //! Core routines shared by all libraries |
| 8 | //! |
| 9 | //! This crate provides a set of core routines shared |
| 10 | //! by the decoders and encoders under `zune` umbrella |
| 11 | //! |
| 12 | //! It currently contains |
| 13 | //! |
| 14 | //! - A bytestream reader and writer with endian aware reads and writes |
| 15 | //! - Colorspace and bit depth information shared by images |
| 16 | //! - Image decoder and encoder options |
| 17 | //! - A simple enum type to hold image decoding results. |
| 18 | //! |
| 19 | //! This library is `#[no_std]` with `alloc` feature needed for defining `Vec` |
| 20 | //! which we need for storing decoded bytes. |
| 21 | //! |
| 22 | //! |
| 23 | //! # Features |
| 24 | //! - `no_std`: Enables `#[no_std]` compilation support. |
| 25 | //! |
| 26 | //! - `serde`: Enables serializing of some of the data structures |
| 27 | //! present in the crate |
| 28 | //! |
| 29 | //! |
| 30 | //! # Input/Output |
| 31 | //! |
| 32 | //! zune-image supports many different input and output devices. For input readers |
| 33 | //! we can read anything that implements `BufRead` + `Seek` and provide an optimized routine for |
| 34 | //! handling in memory buffers by using [`ZCursor`](crate::bytestream::ZCursor). |
| 35 | //! |
| 36 | //! For output, we support anything that implements `Write` trait, this includes files, standard io streams |
| 37 | //! network sockets, etc |
| 38 | //! |
| 39 | //! In a `no_std` environment. We can write to in memory buffers `&mut [u8]` and `&mut Vec<u8>` |
| 40 | //! |
| 41 | //! If you have an in memory buffer, use [`ZCursor`](crate::bytestream::ZCursor), |
| 42 | //! it's optimized for in memory buffers. |
| 43 | //! |
| 44 | //! |
| 45 | //! |
| 46 | #![cfg_attr(not(feature = "std"), no_std)] |
| 47 | #![macro_use] |
| 48 | extern crate alloc; |
| 49 | extern crate core; |
| 50 | |
| 51 | #[cfg(not(feature = "log"))] |
| 52 | pub mod log; |
| 53 | |
| 54 | #[cfg(feature = "log")] |
| 55 | pub use log; |
| 56 | |
| 57 | pub mod bit_depth; |
| 58 | pub mod bytestream; |
| 59 | pub mod colorspace; |
| 60 | pub mod options; |
| 61 | pub mod result; |
| 62 | mod serde; |