(
preset: u32,
filter_specs: Option<Vec<PyObjectRef>>,
vm: &VirtualMachine,
)
| 752 | } |
| 753 | |
| 754 | fn init_alone( |
| 755 | preset: u32, |
| 756 | filter_specs: Option<Vec<PyObjectRef>>, |
| 757 | vm: &VirtualMachine, |
| 758 | ) -> PyResult<Stream> { |
| 759 | if let Some(_filter_specs) = filter_specs { |
| 760 | // TODO: validate single LZMA1 filter and use its options |
| 761 | let options = LzmaOptions::new_preset(preset).map_err(|_| { |
| 762 | new_lzma_error(format!("Invalid compression preset: {preset}"), vm) |
| 763 | })?; |
| 764 | Stream::new_lzma_encoder(&options).map_err(|e| catch_lzma_error(e, vm)) |
| 765 | } else { |
| 766 | let options = LzmaOptions::new_preset(preset).map_err(|_| { |
| 767 | new_lzma_error(format!("Invalid compression preset: {preset}"), vm) |
| 768 | })?; |
| 769 | Stream::new_lzma_encoder(&options).map_err(|e| catch_lzma_error(e, vm)) |
| 770 | } |
| 771 | } |
| 772 | |
| 773 | fn init_raw( |
| 774 | filter_specs: Option<Vec<PyObjectRef>>, |
nothing calls this directly
no test coverage detected