zstd_sys/
bindings_zdict_std.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* automatically generated by rust-bindgen 0.60.1 */

// Copyright 2022 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Generated by ./third_party/rust_crates/forks/zstd-sys/bindgen.sh using bindgen 0.60.1

extern "C" {
    #[doc = " ZDICT_trainFromBuffer():"]
    #[doc = "  Train a dictionary from an array of samples."]
    #[doc = "  Redirect towards ZDICT_optimizeTrainFromBuffer_fastCover() single-threaded, with d=8, steps=4,"]
    #[doc = "  f=20, and accel=1."]
    #[doc = "  Samples must be stored concatenated in a single flat buffer `samplesBuffer`,"]
    #[doc = "  supplied with an array of sizes `samplesSizes`, providing the size of each sample, in order."]
    #[doc = "  The resulting dictionary will be saved into `dictBuffer`."]
    #[doc = " @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`)"]
    #[doc = "          or an error code, which can be tested with ZDICT_isError()."]
    #[doc = "  Note:  Dictionary training will fail if there are not enough samples to construct a"]
    #[doc = "         dictionary, or if most of the samples are too small (< 8 bytes being the lower limit)."]
    #[doc = "         If dictionary training fails, you should use zstd without a dictionary, as the dictionary"]
    #[doc = "         would've been ineffective anyways. If you believe your samples would benefit from a dictionary"]
    #[doc = "         please open an issue with details, and we can look into it."]
    #[doc = "  Note: ZDICT_trainFromBuffer()'s memory usage is about 6 MB."]
    #[doc = "  Tips: In general, a reasonable dictionary has a size of ~ 100 KB."]
    #[doc = "        It's possible to select smaller or larger size, just by specifying `dictBufferCapacity`."]
    #[doc = "        In general, it's recommended to provide a few thousands samples, though this can vary a lot."]
    #[doc = "        It's recommended that total size of all samples be about ~x100 times the target size of dictionary."]
    pub fn ZDICT_trainFromBuffer(
        dictBuffer: *mut ::core::ffi::c_void,
        dictBufferCapacity: usize,
        samplesBuffer: *const ::core::ffi::c_void,
        samplesSizes: *const usize,
        nbSamples: ::std::os::raw::c_uint,
    ) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ZDICT_params_t {
    pub compressionLevel: ::std::os::raw::c_int,
    pub notificationLevel: ::std::os::raw::c_uint,
    pub dictID: ::std::os::raw::c_uint,
}
extern "C" {
    #[doc = " ZDICT_finalizeDictionary():"]
    #[doc = " Given a custom content as a basis for dictionary, and a set of samples,"]
    #[doc = " finalize dictionary by adding headers and statistics according to the zstd"]
    #[doc = " dictionary format."]
    #[doc = ""]
    #[doc = " Samples must be stored concatenated in a flat buffer `samplesBuffer`,"]
    #[doc = " supplied with an array of sizes `samplesSizes`, providing the size of each"]
    #[doc = " sample in order. The samples are used to construct the statistics, so they"]
    #[doc = " should be representative of what you will compress with this dictionary."]
    #[doc = ""]
    #[doc = " The compression level can be set in `parameters`. You should pass the"]
    #[doc = " compression level you expect to use in production. The statistics for each"]
    #[doc = " compression level differ, so tuning the dictionary for the compression level"]
    #[doc = " can help quite a bit."]
    #[doc = ""]
    #[doc = " You can set an explicit dictionary ID in `parameters`, or allow us to pick"]
    #[doc = " a random dictionary ID for you, but we can't guarantee no collisions."]
    #[doc = ""]
    #[doc = " The dstDictBuffer and the dictContent may overlap, and the content will be"]
    #[doc = " appended to the end of the header. If the header + the content doesn't fit in"]
    #[doc = " maxDictSize the beginning of the content is truncated to make room, since it"]
    #[doc = " is presumed that the most profitable content is at the end of the dictionary,"]
    #[doc = " since that is the cheapest to reference."]
    #[doc = ""]
    #[doc = " `maxDictSize` must be >= max(dictContentSize, ZSTD_DICTSIZE_MIN)."]
    #[doc = ""]
    #[doc = " @return: size of dictionary stored into `dstDictBuffer` (<= `maxDictSize`),"]
    #[doc = "          or an error code, which can be tested by ZDICT_isError()."]
    #[doc = " Note: ZDICT_finalizeDictionary() will push notifications into stderr if"]
    #[doc = "       instructed to, using notificationLevel>0."]
    #[doc = " NOTE: This function currently may fail in several edge cases including:"]
    #[doc = "         * Not enough samples"]
    #[doc = "         * Samples are uncompressible"]
    #[doc = "         * Samples are all exactly the same"]
    pub fn ZDICT_finalizeDictionary(
        dstDictBuffer: *mut ::core::ffi::c_void,
        maxDictSize: usize,
        dictContent: *const ::core::ffi::c_void,
        dictContentSize: usize,
        samplesBuffer: *const ::core::ffi::c_void,
        samplesSizes: *const usize,
        nbSamples: ::std::os::raw::c_uint,
        parameters: ZDICT_params_t,
    ) -> usize;
}
extern "C" {
    pub fn ZDICT_getDictID(
        dictBuffer: *const ::core::ffi::c_void,
        dictSize: usize,
    ) -> ::std::os::raw::c_uint;
}
extern "C" {
    pub fn ZDICT_getDictHeaderSize(
        dictBuffer: *const ::core::ffi::c_void,
        dictSize: usize,
    ) -> usize;
}
extern "C" {
    pub fn ZDICT_isError(errorCode: usize) -> ::std::os::raw::c_uint;
}
extern "C" {
    pub fn ZDICT_getErrorName(errorCode: usize) -> *const ::std::os::raw::c_char;
}