| 1 |
// Copyright (c) 2020-present, Gregory Szorc |
| 2 |
// All rights reserved. |
| 3 |
// |
| 4 |
// This software may be modified and distributed under the terms |
| 5 |
// of the BSD license. See the LICENSE file for details. |
| 6 |
|
| 7 |
use pyo3::{prelude::*, types::PySet}; |
| 8 |
|
| 9 |
mod buffers; |
| 10 |
mod compression_chunker; |
| 11 |
mod compression_dict; |
| 12 |
mod compression_parameters; |
| 13 |
mod compression_reader; |
| 14 |
mod compression_writer; |
| 15 |
mod compressionobj; |
| 16 |
mod compressor; |
| 17 |
mod compressor_iterator; |
| 18 |
mod compressor_multi; |
| 19 |
mod constants; |
| 20 |
mod decompression_reader; |
| 21 |
mod decompression_writer; |
| 22 |
mod decompressionobj; |
| 23 |
mod decompressor; |
| 24 |
mod decompressor_iterator; |
| 25 |
mod decompressor_multi; |
| 26 |
mod exceptions; |
| 27 |
mod frame_parameters; |
| 28 |
mod stream; |
| 29 |
mod zstd_safe; |
| 30 |
|
| 31 |
use exceptions::ZstdError; |
| 32 |
|
| 33 |
// Remember to change the string in c-ext/python-zstandard.h, zstandard/__init__.py, |
| 34 |
// and debian/changelog as well. |
| 35 |
const VERSION: &'static str = "0.25.0"; |
| 36 |
|
| 37 |
#[pymodule(gil_used = false)] |
| 38 |
fn backend_rust(py: Python, module: &Bound<'_, PyModule>) -> PyResult<()> { |
| 39 |
let features = PySet::new( |
| 40 |
py, |
| 41 |
&[ |
| 42 |
"buffer_types", |
| 43 |
"multi_compress_to_buffer", |
| 44 |
"multi_decompress_to_buffer", |
| 45 |
], |
| 46 |
)?; |
| 47 |
module.add("backend_features", features)?; |
| 48 |
|
| 49 |
crate::buffers::init_module(module)?; |
| 50 |
crate::compression_dict::init_module(module)?; |
| 51 |
crate::compression_parameters::init_module(module)?; |
| 52 |
crate::compressor::init_module(module)?; |
| 53 |
crate::constants::init_module(py, module)?; |
| 54 |
crate::decompressor::init_module(module)?; |
| 55 |
crate::exceptions::init_module(py, module)?; |
| 56 |
crate::frame_parameters::init_module(module)?; |
| 57 |
|
| 58 |
Ok(()) |
| 59 |
} |