/rust/registry/src/index.crates.io-1949cf8c6b5b557f/lzma-rs-0.2.0/src/encode/options.rs
Line | Count | Source |
1 | | /// Options for the `lzma_compress` function |
2 | | #[derive(Clone, Copy, Debug, Default)] |
3 | | pub struct Options { |
4 | | /// Defines whether the unpacked size should be written to the header. |
5 | | /// The default is |
6 | | /// [`UnpackedSize::WriteToHeader(None)`](enum.encode.UnpackedSize.html#variant.WriteValueToHeader) |
7 | | pub unpacked_size: UnpackedSize, |
8 | | } |
9 | | |
10 | | /// Alternatives for handling unpacked size |
11 | | #[derive(Clone, Copy, Debug)] |
12 | | pub enum UnpackedSize { |
13 | | /// If the value is `Some(u64)`, write the provided u64 value to the header. |
14 | | /// There is currently no check in place that verifies that this is the actual number of bytes |
15 | | /// provided by the input stream. |
16 | | /// If the value is `None`, write the special `0xFFFF_FFFF_FFFF_FFFF` code to the header, |
17 | | /// indicating that the unpacked size is unknown. |
18 | | WriteToHeader(Option<u64>), |
19 | | /// Do not write anything to the header. The unpacked size needs to be stored elsewhere and |
20 | | /// provided when reading the file. Note that this is a non-standard way of writing LZMA data, |
21 | | /// but is used by certain libraries such as |
22 | | /// [OpenCTM](http://openctm.sourceforge.net/). |
23 | | SkipWritingToHeader, |
24 | | } |
25 | | |
26 | | impl Default for UnpackedSize { |
27 | 0 | fn default() -> UnpackedSize { |
28 | 0 | UnpackedSize::WriteToHeader(None) |
29 | 0 | } |
30 | | } |