Debian Codegraph @

src/lz4f/api.rs

raw symbols SCIP
1 #![allow(unsafe_code)]
2
3 use superrust-analyzer cargo lzzzz 2.0.0 lz4f/::{
4 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/,
5 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::{
6 LZ4FCompressionCtxrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FCompressionCtx#, LZ4FCompressionDictrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FCompressionDict#, LZ4FCompressionOptionsrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FCompressionOptions#, LZ4FDecompressionCtxrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FDecompressionCtx#,
7 LZ4FDecompressionOptionsrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FDecompressionOptions#,
8 },
9 Dictionaryrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/Dictionary#,
10 };
11 use craterust-analyzer cargo lzzzz 2.0.0 crate/::lz4frust-analyzer cargo lzzzz 2.0.0 lz4f/::{Errorrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Error#, ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#, FrameInforust-analyzer cargo lzzzz 2.0.0 lz4f/frame_info/FrameInfo#, Preferencesrust-analyzer cargo lzzzz 2.0.0 lz4f/preferences/Preferences#, Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#};
12
13 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::MaybeUninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/MaybeUninit#, osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::rawrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/::c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#, ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#};
14
15 pub const LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTHrust-analyzer cargo lzzzz 2.0.0 lz4f/api/LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH.: usize = 5;
16 pub const LZ4F_HEADER_SIZE_MAXrust-analyzer cargo lzzzz 2.0.0 lz4f/api/LZ4F_HEADER_SIZE_MAX.: usize = 19;
17
18 pub struct CompressionContextrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext# {
19 ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext#ctx.: NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#<LZ4FCompressionCtxrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FCompressionCtx#>,
20 dictrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext#dict.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Dictionaryrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/Dictionary#>,
21 }
22
23 unsafe impl Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# for CompressionContextrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext# {}
24
25 impl CompressionContextrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext# {
26 pub fn newrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[CompressionContext]new().(dict: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Dictionaryrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/Dictionary#>) -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<Selfrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[CompressionContext]> {
27 let ctx = MaybeUninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/MaybeUninit#::<*mut LZ4FCompressionCtxrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FCompressionCtx#>::uninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]uninit().();
28 unsafe {
29 let code = bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_createCompressionContextrust-analyzer cargo lzzzz 2.0.0 LZ4F_createCompressionContext().(
30 ctx.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]as_ptr().() as *mut *mut bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4FCompressionCtxrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FCompressionCtx#,
31 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_getVersionrust-analyzer cargo lzzzz 2.0.0 LZ4F_getVersion().(),
32 );
33 result_from_coderust-analyzer cargo lzzzz 2.0.0 lz4f/api/result_from_code().(code).and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]and_then().(|_| {
34 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[CompressionContext] {
35 ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext#ctx.: NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]new().(ctx.assume_initrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]assume_init().())
36 .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| craterust-analyzer cargo lzzzz 2.0.0 crate/::Errorrust-analyzer cargo lzzzz 2.0.0 common/error/Error#::newrust-analyzer cargo lzzzz 2.0.0 common/error/impl#[Error]new().(craterust-analyzer cargo lzzzz 2.0.0 crate/::ErrorKindrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#::InitializationFailedrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#InitializationFailed#))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
37 dictrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext#dict.,
38 })
39 })
40 }
41 }
42
43 pub fn beginrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[CompressionContext]begin().(&mut self, dst: *mut u8, dst_len: usize, prefs: &Preferencesrust-analyzer cargo lzzzz 2.0.0 lz4f/preferences/Preferences#) -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<usize> {
44 let code = unsafe {
45 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dict) = &self.dictrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext#dict. {
46 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_compressBegin_usingCDictrust-analyzer cargo lzzzz 2.0.0 LZ4F_compressBegin_usingCDict().(
47 self.ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext#ctx..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]as_ptr().(),
48 dst as *mut c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#,
49 dst_len,
50 dict.handlerust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/impl#[Dictionary]handle().().0rust-analyzer cargo lzzzz 2.0.0 lz4f/api/DictionaryHandle#0..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]as_ptr().(),
51 prefs as *const Preferencesrust-analyzer cargo lzzzz 2.0.0 lz4f/preferences/Preferences#,
52 )
53 } else {
54 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_compressBeginrust-analyzer cargo lzzzz 2.0.0 LZ4F_compressBegin().(self.ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext#ctx..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]as_ptr().(), dst as *mut c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#, dst_len, prefs)
55 }
56 };
57 result_from_coderust-analyzer cargo lzzzz 2.0.0 lz4f/api/result_from_code().(code).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| code)
58 }
59
60 pub fn updaterust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[CompressionContext]update().(
61 &mut self,
62 dst: *mut u8,
63 dst_len: usize,
64 src: &[u8],
65 stable_src: bool,
66 ) -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<usize> {
67 let opt = LZ4FCompressionOptionsrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FCompressionOptions#::stablerust-analyzer cargo lzzzz 2.0.0 lz4f/binding/impl#[LZ4FCompressionOptions]stable().(stable_src);
68 let code = unsafe {
69 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_compressUpdaterust-analyzer cargo lzzzz 2.0.0 LZ4F_compressUpdate().(
70 self.ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext#ctx..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]as_ptr().(),
71 dst as *mut c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#,
72 dst_len,
73 src.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#,
74 src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(),
75 &opt as *const LZ4FCompressionOptionsrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FCompressionOptions#,
76 )
77 };
78 result_from_coderust-analyzer cargo lzzzz 2.0.0 lz4f/api/result_from_code().(code).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| code)
79 }
80
81 pub fn flushrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[CompressionContext]flush().(&mut self, dst: *mut u8, dst_len: usize, stable_src: bool) -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<usize> {
82 let opt = LZ4FCompressionOptionsrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FCompressionOptions#::stablerust-analyzer cargo lzzzz 2.0.0 lz4f/binding/impl#[LZ4FCompressionOptions]stable().(stable_src);
83 let code = unsafe {
84 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_flushrust-analyzer cargo lzzzz 2.0.0 LZ4F_flush().(
85 self.ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext#ctx..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]as_ptr().(),
86 dst as *mut c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#,
87 dst_len,
88 &opt as *const LZ4FCompressionOptionsrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FCompressionOptions#,
89 )
90 };
91 result_from_coderust-analyzer cargo lzzzz 2.0.0 lz4f/api/result_from_code().(code).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| code)
92 }
93
94 pub fn endrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[CompressionContext]end().(&mut self, dst: *mut u8, dst_len: usize, stable_src: bool) -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<usize> {
95 let opt = LZ4FCompressionOptionsrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FCompressionOptions#::stablerust-analyzer cargo lzzzz 2.0.0 lz4f/binding/impl#[LZ4FCompressionOptions]stable().(stable_src);
96 let code = unsafe {
97 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_compressEndrust-analyzer cargo lzzzz 2.0.0 LZ4F_compressEnd().(
98 self.ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext#ctx..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]as_ptr().(),
99 dst as *mut c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#,
100 dst_len,
101 &opt as *const LZ4FCompressionOptionsrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FCompressionOptions#,
102 )
103 };
104 result_from_coderust-analyzer cargo lzzzz 2.0.0 lz4f/api/result_from_code().(code).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| code)
105 }
106
107 pub fn compress_boundrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[CompressionContext]compress_bound().(src_size: usize, prefs: &Preferencesrust-analyzer cargo lzzzz 2.0.0 lz4f/preferences/Preferences#) -> usize {
108 unsafe { bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_compressBoundrust-analyzer cargo lzzzz 2.0.0 LZ4F_compressBound().(src_size, prefs as *const Preferencesrust-analyzer cargo lzzzz 2.0.0 lz4f/preferences/Preferences#) }
109 }
110 }
111
112 impl Droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/drop/Drop# for CompressionContextrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext# {
113 fn droprust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[CompressionContext][Drop]drop().(&mut self) {
114 unsafe {
115 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_freeCompressionContextrust-analyzer cargo lzzzz 2.0.0 LZ4F_freeCompressionContext().(self.ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/CompressionContext#ctx..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]as_ptr().());
116 }
117 }
118 }
119
120 pub struct DecompressionContextrust-analyzer cargo lzzzz 2.0.0 lz4f/api/DecompressionContext# {
121 ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/DecompressionContext#ctx.: NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#<LZ4FDecompressionCtxrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FDecompressionCtx#>,
122 }
123
124 unsafe impl Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# for DecompressionContextrust-analyzer cargo lzzzz 2.0.0 lz4f/api/DecompressionContext# {}
125
126 impl DecompressionContextrust-analyzer cargo lzzzz 2.0.0 lz4f/api/DecompressionContext# {
127 pub fn newrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DecompressionContext]new().() -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<Selfrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DecompressionContext]> {
128 let ctx = MaybeUninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/MaybeUninit#::<*mut LZ4FDecompressionCtxrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FDecompressionCtx#>::uninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]uninit().();
129 unsafe {
130 let code = bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_createDecompressionContextrust-analyzer cargo lzzzz 2.0.0 LZ4F_createDecompressionContext().(
131 ctx.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]as_ptr().() as *mut *mut bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4FDecompressionCtxrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FDecompressionCtx#,
132 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_getVersionrust-analyzer cargo lzzzz 2.0.0 LZ4F_getVersion().(),
133 );
134 result_from_coderust-analyzer cargo lzzzz 2.0.0 lz4f/api/result_from_code().(code).and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]and_then().(|_| {
135 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DecompressionContext] {
136 ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/DecompressionContext#ctx.: NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]new().(ctx.assume_initrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]assume_init().())
137 .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| craterust-analyzer cargo lzzzz 2.0.0 crate/::Errorrust-analyzer cargo lzzzz 2.0.0 common/error/Error#::newrust-analyzer cargo lzzzz 2.0.0 common/error/impl#[Error]new().(craterust-analyzer cargo lzzzz 2.0.0 crate/::ErrorKindrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#::InitializationFailedrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#InitializationFailed#))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
138 })
139 })
140 }
141 }
142
143 pub fn get_frame_inforust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DecompressionContext]get_frame_info().(&self, src: &[u8]) -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<(FrameInforust-analyzer cargo lzzzz 2.0.0 lz4f/frame_info/FrameInfo#, usize)> {
144 let mut info = MaybeUninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/MaybeUninit#::<FrameInforust-analyzer cargo lzzzz 2.0.0 lz4f/frame_info/FrameInfo#>::uninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]uninit().();
145 let mut src_len = src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().();
146 let code = unsafe {
147 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_getFrameInforust-analyzer cargo lzzzz 2.0.0 LZ4F_getFrameInfo().(
148 self.ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/DecompressionContext#ctx..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]as_ptr().(),
149 info.as_mut_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]as_mut_ptr().(),
150 src.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#,
151 &mut src_len as *mut usize,
152 )
153 };
154 result_from_coderust-analyzer cargo lzzzz 2.0.0 lz4f/api/result_from_code().(code).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| (unsafe { info.assume_initrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]assume_init().() }, src_len))
155 }
156
157 pub fn decompress_dictrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DecompressionContext]decompress_dict().(
158 &mut self,
159 src: &[u8],
160 dst: &mut [u8],
161 dict: &[u8],
162 stable_dst: bool,
163 ) -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<(usize, usize, usize)> {
164 let mut dst_len = dst.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().();
165 let mut src_len = src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().();
166 let opt = LZ4FDecompressionOptionsrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FDecompressionOptions#::stablerust-analyzer cargo lzzzz 2.0.0 lz4f/binding/impl#[LZ4FDecompressionOptions]stable().(stable_dst);
167 let code = unsafe {
168 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_decompress_usingDictrust-analyzer cargo lzzzz 2.0.0 LZ4F_decompress_usingDict().(
169 self.ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/DecompressionContext#ctx..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]as_ptr().(),
170 dst.as_mut_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_mut_ptr().() as *mut c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#,
171 &mut dst_len as *mut usize,
172 src.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#,
173 &mut src_len as *mut usize,
174 dict.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#,
175 dict.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(),
176 &opt as *const LZ4FDecompressionOptionsrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FDecompressionOptions#,
177 )
178 };
179 result_from_coderust-analyzer cargo lzzzz 2.0.0 lz4f/api/result_from_code().(code).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| (src_len, dst_len, code))
180 }
181
182 pub fn resetrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DecompressionContext]reset().(&mut self) {
183 unsafe {
184 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_resetDecompressionContextrust-analyzer cargo lzzzz 2.0.0 LZ4F_resetDecompressionContext().(self.ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/DecompressionContext#ctx..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]as_ptr().());
185 }
186 }
187 }
188
189 impl Droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/drop/Drop# for DecompressionContextrust-analyzer cargo lzzzz 2.0.0 lz4f/api/DecompressionContext# {
190 fn droprust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DecompressionContext][Drop]drop().(&mut self) {
191 unsafe {
192 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_freeDecompressionContextrust-analyzer cargo lzzzz 2.0.0 LZ4F_freeDecompressionContext().(self.ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/api/DecompressionContext#ctx..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]as_ptr().());
193 }
194 }
195 }
196
197 pub fn compress_frame_boundrust-analyzer cargo lzzzz 2.0.0 lz4f/api/compress_frame_bound().(src_size: usize, prefs: &Preferencesrust-analyzer cargo lzzzz 2.0.0 lz4f/preferences/Preferences#) -> usize {
198 unsafe { bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_compressFrameBoundrust-analyzer cargo lzzzz 2.0.0 LZ4F_compressFrameBound().(src_size, prefs as *const Preferencesrust-analyzer cargo lzzzz 2.0.0 lz4f/preferences/Preferences#) }
199 }
200
201 pub fn header_sizerust-analyzer cargo lzzzz 2.0.0 lz4f/api/header_size().(src: &[u8]) -> usize {
202 unsafe { bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_headerSizerust-analyzer cargo lzzzz 2.0.0 LZ4F_headerSize().(src.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#, src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()) }
203 }
204
205 pub fn compressrust-analyzer cargo lzzzz 2.0.0 lz4f/api/compress().(src: &[u8], dst: *mut u8, dst_len: usize, prefs: &Preferencesrust-analyzer cargo lzzzz 2.0.0 lz4f/preferences/Preferences#) -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<usize> {
206 let code = unsafe {
207 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_compressFramerust-analyzer cargo lzzzz 2.0.0 LZ4F_compressFrame().(
208 dst as *mut c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#,
209 dst_len,
210 src.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#,
211 src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(),
212 prefs as *const Preferencesrust-analyzer cargo lzzzz 2.0.0 lz4f/preferences/Preferences#,
213 )
214 };
215 result_from_coderust-analyzer cargo lzzzz 2.0.0 lz4f/api/result_from_code().(code).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| code)
216 }
217
218 fn result_from_coderust-analyzer cargo lzzzz 2.0.0 lz4f/api/result_from_code().(code: usize) -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<()> {
219 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Error#::newrust-analyzer cargo lzzzz 2.0.0 lz4f/error/impl#[Error]new().(match code.wrapping_negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]wrapping_neg().() {
220 1 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::Genericrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#Generic#,
221 2 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::MaxBlockSizeInvalidrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#MaxBlockSizeInvalid#,
222 3 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::BlockModeInvalidrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#BlockModeInvalid#,
223 4 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::ContentChecksumFlagInvalidrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#ContentChecksumFlagInvalid#,
224 5 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::CompressionLevelInvalidrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#CompressionLevelInvalid#,
225 6 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::HeaderVersionWrongrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#HeaderVersionWrong#,
226 7 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::BlockChecksumInvalidrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#BlockChecksumInvalid#,
227 8 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::ReservedFlagSetrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#ReservedFlagSet#,
228 9 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::AllocationFailedrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#AllocationFailed#,
229 10 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::SrcSizeTooLargerust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#SrcSizeTooLarge#,
230 11 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::DstMaxSizeTooSmallrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#DstMaxSizeTooSmall#,
231 12 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::FrameHeaderIncompleterust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#FrameHeaderIncomplete#,
232 13 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::FrameTypeUnknownrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#FrameTypeUnknown#,
233 14 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::FrameSizeWrongrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#FrameSizeWrong#,
234 15 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::SrcPtrWrongrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#SrcPtrWrong#,
235 16 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::DecompressionFailedrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#DecompressionFailed#,
236 17 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::HeaderChecksumInvalidrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#HeaderChecksumInvalid#,
237 18 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::ContentChecksumInvalidrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#ContentChecksumInvalid#,
238 19 => ErrorKindrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#::FrameDecodingAlreadyStartedrust-analyzer cargo lzzzz 2.0.0 lz4f/error/ErrorKind#FrameDecodingAlreadyStarted#,
239 _ => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()),
240 }))
241 }
242
243 pub struct DictionaryHandlerust-analyzer cargo lzzzz 2.0.0 lz4f/api/DictionaryHandle#(NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#<LZ4FCompressionDictrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/LZ4FCompressionDict#>);
244
245 unsafe impl Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# for DictionaryHandlerust-analyzer cargo lzzzz 2.0.0 lz4f/api/DictionaryHandle# {}
246 unsafe impl Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# for DictionaryHandlerust-analyzer cargo lzzzz 2.0.0 lz4f/api/DictionaryHandle# {}
247
248 impl DictionaryHandlerust-analyzer cargo lzzzz 2.0.0 lz4f/api/DictionaryHandle# {
249 pub fn newrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DictionaryHandle]new().(data: &[u8]) -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<Selfrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DictionaryHandle]> {
250 let dict = unsafe { bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_createCDictrust-analyzer cargo lzzzz 2.0.0 LZ4F_createCDict().(data.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#, data.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()) };
251 NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]new().(dict)
252 .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| craterust-analyzer cargo lzzzz 2.0.0 crate/::Errorrust-analyzer cargo lzzzz 2.0.0 common/error/Error#::newrust-analyzer cargo lzzzz 2.0.0 common/error/impl#[Error]new().(craterust-analyzer cargo lzzzz 2.0.0 crate/::ErrorKindrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#::InitializationFailedrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#InitializationFailed#).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())
253 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Selfrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DictionaryHandle])
254 }
255 }
256
257 impl Droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/drop/Drop# for DictionaryHandlerust-analyzer cargo lzzzz 2.0.0 lz4f/api/DictionaryHandle# {
258 fn droprust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DictionaryHandle][Drop]drop().(&mut self) {
259 unsafe {
260 bindingrust-analyzer cargo lzzzz 2.0.0 lz4f/binding/::LZ4F_freeCDictrust-analyzer cargo lzzzz 2.0.0 LZ4F_freeCDict().(self.0rust-analyzer cargo lzzzz 2.0.0 lz4f/api/DictionaryHandle#0..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]as_ptr().());
261 }
262 }
263 }