Debian Codegraph @

src/lib.rs

raw symbols SCIP
1 #![no_std]
2 #![allow(non_snake_case)]
3 #![allow(clippy::too_many_arguments)]
4 #![deny(unreachable_pub)]
5 #![deny(unsafe_op_in_unsafe_fn)]
6
7 //! A drop-in compatible rust implementation of bzip2
8
9 #[cfg(feature = "std")]
10 extern crate stdrust-analyzer cargo libbz2-rs-sys 0.2.5 std/;
11
12 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::ffirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/::c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
13 #[cfg(not(feature = "std"))]
14 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/::atomicrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/::{AtomicI32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicI32#, Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#};
15
16 mod allocatorrust-analyzer cargo libbz2-rs-sys 0.2.5 allocator/;
17 mod blocksortrust-analyzer cargo libbz2-rs-sys 0.2.5 blocksort/;
18 mod bzlibrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/;
19 mod compressrust-analyzer cargo libbz2-rs-sys 0.2.5 compress/;
20 mod crctablerust-analyzer cargo libbz2-rs-sys 0.2.5 crctable/;
21 mod decompressrust-analyzer cargo libbz2-rs-sys 0.2.5 decompress/;
22 #[cfg(feature = "stdio")]
23 mod high_levelrust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/;
24 mod huffmanrust-analyzer cargo libbz2-rs-sys 0.2.5 huffman/;
25 mod randtablerust-analyzer cargo libbz2-rs-sys 0.2.5 randtable/;
26
27 pub(craterust-analyzer cargo libbz2-rs-sys 0.2.5 crate/) use bzlibrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/::{Actionrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/Action#, ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#};
28
29 pub const BZ_OKrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_OK.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_OKrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_OK# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
30 pub const BZ_RUN_OKrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_RUN_OK.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_RUN_OKrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_RUN_OK# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
31 pub const BZ_FLUSH_OKrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_FLUSH_OK.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_FLUSH_OKrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_FLUSH_OK# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
32 pub const BZ_FINISH_OKrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_FINISH_OK.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_FINISH_OKrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_FINISH_OK# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
33 pub const BZ_STREAM_ENDrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_STREAM_END.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_STREAM_ENDrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_STREAM_END# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
34 pub const BZ_SEQUENCE_ERRORrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_SEQUENCE_ERROR.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_SEQUENCE_ERRORrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_SEQUENCE_ERROR# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
35 pub const BZ_PARAM_ERRORrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_PARAM_ERROR.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_PARAM_ERRORrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_PARAM_ERROR# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
36 pub const BZ_MEM_ERRORrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_MEM_ERROR.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_MEM_ERRORrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_MEM_ERROR# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
37 pub const BZ_DATA_ERRORrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_DATA_ERROR.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_DATA_ERRORrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_DATA_ERROR# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
38 pub const BZ_DATA_ERROR_MAGICrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_DATA_ERROR_MAGIC.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_DATA_ERROR_MAGICrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_DATA_ERROR_MAGIC# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
39 pub const BZ_IO_ERRORrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_IO_ERROR.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_IO_ERRORrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_IO_ERROR# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
40 pub const BZ_UNEXPECTED_EOFrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_UNEXPECTED_EOF.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_UNEXPECTED_EOFrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_UNEXPECTED_EOF# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
41 pub const BZ_OUTBUFF_FULLrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_OUTBUFF_FULL.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_OUTBUFF_FULLrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_OUTBUFF_FULL# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
42 pub const BZ_CONFIG_ERRORrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_CONFIG_ERROR.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = ReturnCoderust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#::BZ_CONFIG_ERRORrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/ReturnCode#BZ_CONFIG_ERROR# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
43
44 pub const BZ_RUNrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_RUN.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = Actionrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/Action#::Runrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/Action#Run# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
45 pub const BZ_FLUSHrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_FLUSH.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = Actionrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/Action#::Flushrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/Action#Flush# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
46 pub const BZ_FINISHrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_FINISH.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = Actionrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/Action#::Finishrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/Action#Finish# as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
47
48 pub const BZ_MAX_UNUSEDrust-analyzer cargo libbz2-rs-sys 0.2.5 BZ_MAX_UNUSED.: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = bzlibrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/::BZ_MAX_UNUSED_U32rust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/BZ_MAX_UNUSED_U32. as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
49
50 // types
51 pub use bzlibrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/::bz_streamrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/bz_stream#;
52 #[cfg(feature = "stdio")]
53 pub use bzlibrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/::BZFILErust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZFILE#;
54
55 // the low-level interface
56 pub use bzlibrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/::{BZ2_bzCompressrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/BZ2_bzCompress()., BZ2_bzCompressEndrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/BZ2_bzCompressEnd()., BZ2_bzCompressInitrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/BZ2_bzCompressInit().};
57 pub use bzlibrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/::{BZ2_bzDecompressrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/BZ2_bzDecompress()., BZ2_bzDecompressEndrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/BZ2_bzDecompressEnd()., BZ2_bzDecompressInitrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/BZ2_bzDecompressInit().};
58
59 // utility functions
60 pub use bzlibrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/::{BZ2_bzBuffToBuffCompressrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/BZ2_bzBuffToBuffCompress()., BZ2_bzBuffToBuffDecompressrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/BZ2_bzBuffToBuffDecompress().};
61
62 // the high-level interface
63 #[cfg(feature = "stdio")]
64 pub use bzlibrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/::{BZ2_bzReadrust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzRead()., BZ2_bzReadCloserust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzReadClose()., BZ2_bzReadGetUnusedrust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzReadGetUnused()., BZ2_bzReadOpenrust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzReadOpen().};
65 #[cfg(feature = "stdio")]
66 pub use bzlibrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/::{BZ2_bzWriterust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzWrite()., BZ2_bzWriteCloserust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzWriteClose()., BZ2_bzWriteClose64rust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzWriteClose64()., BZ2_bzWriteOpenrust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzWriteOpen().};
67
68 // zlib compatibility functions
69 #[cfg(feature = "stdio")]
70 pub use bzlibrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/::{
71 BZ2_bzcloserust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzclose()., BZ2_bzdopenrust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzdopen()., BZ2_bzerrorrust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzerror()., BZ2_bzflushrust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzflush()., BZ2_bzlibVersionrust-analyzer cargo libbz2-rs-sys 0.2.5 bzlib/BZ2_bzlibVersion()., BZ2_bzopenrust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzopen()., BZ2_bzreadrust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzread().,
72 BZ2_bzwriterust-analyzer cargo libbz2-rs-sys 0.2.5 high_level/BZ2_bzwrite().,
73 };
74
75 // --- version number logic
76
77 macro_rules! libbz2_rs_sys_versionrust-analyzer cargo libbz2-rs-sys 0.2.5 libbz2_rs_sys_version! {
78 () => {
79 concat!("1.1.0-libbz2-rs-sys-", env!("CARGO_PKG_VERSION"))
80 };
81 }
82
83 pub(craterust-analyzer cargo libbz2-rs-sys 0.2.5 crate/) use libbz2_rs_sys_versionrust-analyzer cargo libbz2-rs-sys 0.2.5 libbz2_rs_sys_version!;
84
85 // --- debug logs
86
87 #[cfg(all(not(feature = "std"), feature = "stdio"))]
88 pub(craterust-analyzer cargo libbz2-rs-sys 0.2.5 crate/) struct StderrWritter;
89
90 #[cfg(all(not(feature = "std"), feature = "stdio"))]
91 impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write# for StderrWritter {
92 fn write_str(&mut self, s: &str) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
93 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::ffirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/::c_voidrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_void#;
94 use libcrust-analyzer cargo libc 0.2.161 crate/::writerust-analyzer cargo libc 0.2.161 write().;
95
96 unsafe { writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!(2, s.as_ptr() as *const c_void, s.len() as _) };
97
98 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
99 }
100 }
101
102 macro_rules! debug_logrust-analyzer cargo libbz2-rs-sys 0.2.5 debug_log! {
103 ($($arg:tt)*) => {
104 #[cfg(feature = "std")]
105 std::eprint!($($arg)*);
106 #[cfg(all(not(feature = "std"), feature = "stdio"))]
107 {
108 use core::fmt::Write;
109 let _ = write!($crate::StderrWritter, $($arg)*);
110 }
111 };
112 }
113
114 macro_rules! debug_loglnrust-analyzer cargo libbz2-rs-sys 0.2.5 debug_logln! {
115 ($($arg:tt)*) => {
116 #[cfg(feature = "std")]
117 std::eprintln!($($arg)*);
118 #[cfg(all(not(feature = "std"), feature = "stdio"))]
119 {
120 use core::fmt::Write;
121 let _ = writeln!($crate::StderrWritter, $($arg)*);
122 }
123 };
124 }
125
126 pub(craterust-analyzer cargo libbz2-rs-sys 0.2.5 crate/) use debug_logrust-analyzer cargo libbz2-rs-sys 0.2.5 debug_log!;
127 pub(craterust-analyzer cargo libbz2-rs-sys 0.2.5 crate/) use debug_loglnrust-analyzer cargo libbz2-rs-sys 0.2.5 debug_logln!;
128
129 // --- assert failure logic
130
131 macro_rules! assert_hrust-analyzer cargo libbz2-rs-sys 0.2.5 assert_h! {
132 ($condition:expr, $errcode:expr) => {
133 if !$condition {
134 $crate::handle_assert_failure($errcode)
135 }
136 };
137 }
138
139 #[cfg(not(feature = "std"))]
140 #[doc(hidden)]
141 pub static ASSERT_CODE: AtomicI32 = AtomicI32::new(-1);
142
143 #[cold]
144 fn handle_assert_failurerust-analyzer cargo libbz2-rs-sys 0.2.5 handle_assert_failure().(errcode: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#) -> ! {
145 #[cfg(feature = "std")]
146 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::eprintrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/eprint!!("{}", AssertFailrust-analyzer cargo libbz2-rs-sys 0.2.5 AssertFail#(errcode));
147 #[cfg(feature = "std")]
148 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::processrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/::exitrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/exit().(3);
149
150 // Stash the assertion code for the panic handler in the cdylib to pass to bz_internal_error.
151 // Using relaxed ordering as this will be accessed on the same thread.
152 #[cfg(not(feature = "std"))]
153 #[allow(clippy::unnecessary_cast)]
154 ASSERT_CODE.store(errcode as i32, Ordering::Relaxed);
155 #[cfg(not(feature = "std"))]
156 panicrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/panic!!("{}", AssertFailrust-analyzer cargo libbz2-rs-sys 0.2.5 AssertFail#(errcode));
157 }
158
159 use assert_hrust-analyzer cargo libbz2-rs-sys 0.2.5 assert_h!;
160
161 struct AssertFailrust-analyzer cargo libbz2-rs-sys 0.2.5 AssertFail#(i32);
162
163 impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for AssertFailrust-analyzer cargo libbz2-rs-sys 0.2.5 AssertFail# {
164 fn fmtrust-analyzer cargo libbz2-rs-sys 0.2.5 impl#[AssertFail][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
165 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(
166 f,
167 concatrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/concat!!(
168 "\n",
169 "\n",
170 "libbzip2-rs: internal error number {}.\n",
171 "This is a bug in libbzip2-rs, {}.\n",
172 "Please report it at: https://github.com/trifectatechfoundation/libbzip2-rs/issues\n",
173 "If this happened when you were using some program which uses\n",
174 "libbzip2-rs as a component, you should also report this bug to\n",
175 "the author(s) of that program.\n",
176 "Please make an effort to report this bug;\n",
177 "timely and accurate bug reports eventually lead to higher\n",
178 "quality software. Thanks.\n",
179 "\n"
180 ),
181 self.0rust-analyzer cargo libbz2-rs-sys 0.2.5 AssertFail#0.,
182 libbz2_rs_sys_versionrust-analyzer cargo libbz2-rs-sys 0.2.5 libbz2_rs_sys_version!!(),
183 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
184
185 if self.0rust-analyzer cargo libbz2-rs-sys 0.2.5 AssertFail#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().1007 {
186 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(
187 f,
188 concatrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/concat!!(
189 "\n",
190 "*** A special note about internal error number 1007 ***\n",
191 "\n",
192 "Experience suggests that a common cause of i.e. 1007\n",
193 "is unreliable memory or other hardware. The 1007 assertion\n",
194 "just happens to cross-check the results of huge numbers of\n",
195 "memory reads/writes, and so acts (unintendedly) as a stress\n",
196 "test of your memory system.\n",
197 "\n",
198 "I suggest the following: try compressing the file again,\n",
199 "possibly monitoring progress in detail with the -vv flag.\n",
200 "\n",
201 "* If the error cannot be reproduced, and/or happens at different\n",
202 " points in compression, you may have a flaky memory system.\n",
203 " Try a memory-test program. I have used Memtest86\n",
204 " (www.memtest86.com). At the time of writing it is free (GPLd).\n",
205 " Memtest86 tests memory much more thorougly than your BIOSs\n",
206 " power-on test, and may find failures that the BIOS doesn't.\n",
207 "\n",
208 "* If the error can be repeatably reproduced, this is a bug in\n",
209 " bzip2, and I would very much like to hear about it. Please\n",
210 " let me know, and, ideally, save a copy of the file causing the\n",
211 " problem -- without which I will be unable to investigate it.\n",
212 "\n"
213 )
214 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
215 }
216
217 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
218 }
219 }
220
221 #[cfg(test)]
222 mod testrust-analyzer cargo libbz2-rs-sys 0.2.5 test/ {
223 extern crate allocrust-analyzer cargo libbz2-rs-sys 0.2.5 test/alloc/;
224
225 use superrust-analyzer cargo libbz2-rs-sys 0.2.5 crate/::*;
226
227 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
228
229 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
230 fn print_assert_fail_coveragerust-analyzer cargo libbz2-rs-sys 0.2.5 test/print_assert_fail_coverage().() {
231 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#;
232 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(&mut Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(), "{}", AssertFailrust-analyzer cargo libbz2-rs-sys 0.2.5 AssertFail#(1007)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
233 }
234 }