| 1 | #![allow(unsafe_code)] |
| 2 | |
| 3 | use superrust-analyzer cargo lzzzz 2.0.0 lz4/block/::superrust-analyzer cargo lzzzz 2.0.0 lz4/::bindingrust-analyzer cargo lzzzz 2.0.0 lz4/binding/; |
| 4 | use craterust-analyzer cargo lzzzz 2.0.0 crate/::{Errorrust-analyzer cargo lzzzz 2.0.0 common/error/Error#, ErrorKindrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#, Resultrust-analyzer cargo lzzzz 2.0.0 common/error/Result#}; |
| 5 | |
| 6 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{ |
| 7 | cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/::RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#, |
| 8 | opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#, |
| 9 | 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_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, c_voidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_void#}, |
| 10 | }; |
| 11 | |
| 12 | const LZ4_MAX_INPUT_SIZErust-analyzer cargo lzzzz 2.0.0 lz4/block/api/LZ4_MAX_INPUT_SIZE.: usize = 0x7E00_0000; |
| 13 | |
| 14 | pub const fn compress_boundrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/compress_bound().(input_size: usize) -> usize { |
| 15 | (input_size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().LZ4_MAX_INPUT_SIZErust-analyzer cargo lzzzz 2.0.0 lz4/block/api/LZ4_MAX_INPUT_SIZE.) as usize rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().(input_size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().(input_size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().255) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().16) |
| 16 | } |
| 17 | |
| 18 | pub const fn size_of_staterust-analyzer cargo lzzzz 2.0.0 lz4/block/api/size_of_state().() -> usize { |
| 19 | bindingrust-analyzer cargo lzzzz 2.0.0 lz4/binding/::LZ4_STREAMSIZErust-analyzer cargo lzzzz 2.0.0 lz4/binding/LZ4_STREAMSIZE. |
| 20 | } |
| 21 | |
| 22 | pub fn compress_fast_ext_staterust-analyzer cargo lzzzz 2.0.0 lz4/block/api/compress_fast_ext_state().( |
| 23 | state: &mut [u8], |
| 24 | src: &[u8], |
| 25 | dst: *mut u8, |
| 26 | dst_len: usize, |
| 27 | acceleration: i32, |
| 28 | ) -> usize { |
| 29 | unsafe { |
| 30 | bindingrust-analyzer cargo lzzzz 2.0.0 lz4/binding/::LZ4_compress_fast_extStaterust-analyzer cargo lzzzz 2.0.0 LZ4_compress_fast_extState().( |
| 31 | state.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#, |
| 32 | src.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 33 | dst as *mut c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 34 | src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 35 | dst_len as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 36 | acceleration as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 37 | ) as usize |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | pub fn compress_fast_ext_state_fast_resetrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/compress_fast_ext_state_fast_reset().( |
| 42 | state: &mut [u8], |
| 43 | src: &[u8], |
| 44 | dst: *mut u8, |
| 45 | dst_len: usize, |
| 46 | acceleration: i32, |
| 47 | ) -> usize { |
| 48 | unsafe { |
| 49 | bindingrust-analyzer cargo lzzzz 2.0.0 lz4/binding/::LZ4_compress_fast_extState_fastResetrust-analyzer cargo lzzzz 2.0.0 LZ4_compress_fast_extState_fastReset().( |
| 50 | state.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#, |
| 51 | src.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 52 | dst as *mut c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 53 | src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 54 | dst_len as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 55 | acceleration as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 56 | ) as usize |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | pub fn compress_dest_sizerust-analyzer cargo lzzzz 2.0.0 lz4/block/api/compress_dest_size().( |
| 61 | src: &[u8], |
| 62 | dst: &mut [u8], |
| 63 | ) -> Resultrust-analyzer cargo lzzzz 2.0.0 common/error/Result#<(usize, usize)> { |
| 64 | let mut src_size: c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int# = src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#; |
| 65 | let result = unsafe { |
| 66 | bindingrust-analyzer cargo lzzzz 2.0.0 lz4/binding/::LZ4_compress_destSizerust-analyzer cargo lzzzz 2.0.0 LZ4_compress_destSize().( |
| 67 | src.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 68 | dst.as_mut_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_mut_ptr().() as *mut c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 69 | &mut src_size as *mut c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 70 | dst.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 71 | ) |
| 72 | }; |
| 73 | if result 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().0 { |
| 74 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo lzzzz 2.0.0 common/error/Error#::newrust-analyzer cargo lzzzz 2.0.0 common/error/impl#[Error]new().(ErrorKindrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#::CompressionFailedrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#CompressionFailed#)) |
| 75 | } else { |
| 76 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((src_size as usize, result as usize)) |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | pub fn decompress_saferust-analyzer cargo lzzzz 2.0.0 lz4/block/api/decompress_safe().(src: &[u8], dst: &mut [u8]) -> Resultrust-analyzer cargo lzzzz 2.0.0 common/error/Result#<usize> { |
| 81 | let result = unsafe { |
| 82 | bindingrust-analyzer cargo lzzzz 2.0.0 lz4/binding/::LZ4_decompress_saferust-analyzer cargo lzzzz 2.0.0 LZ4_decompress_safe().( |
| 83 | src.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 84 | dst.as_mut_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_mut_ptr().() as *mut c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 85 | src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 86 | dst.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 87 | ) |
| 88 | }; |
| 89 | if result rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().0 { |
| 90 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo lzzzz 2.0.0 common/error/Error#::newrust-analyzer cargo lzzzz 2.0.0 common/error/impl#[Error]new().(ErrorKindrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#::DecompressionFailedrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#DecompressionFailed#)) |
| 91 | } else { |
| 92 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result as usize) |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | pub fn decompress_safe_partialrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/decompress_safe_partial().(src: &[u8], dst: &mut [u8], original_size: usize) -> Resultrust-analyzer cargo lzzzz 2.0.0 common/error/Result#<usize> { |
| 97 | let result = unsafe { |
| 98 | bindingrust-analyzer cargo lzzzz 2.0.0 lz4/binding/::LZ4_decompress_safe_partialrust-analyzer cargo lzzzz 2.0.0 LZ4_decompress_safe_partial().( |
| 99 | src.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 100 | dst.as_mut_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_mut_ptr().() as *mut c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 101 | src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 102 | original_size as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 103 | dst.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 104 | ) |
| 105 | }; |
| 106 | if result rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().0 { |
| 107 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo lzzzz 2.0.0 common/error/Error#::newrust-analyzer cargo lzzzz 2.0.0 common/error/impl#[Error]new().(ErrorKindrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#::DecompressionFailedrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#DecompressionFailed#)) |
| 108 | } else { |
| 109 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result as usize) |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | pub fn decompress_safe_using_dictrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/decompress_safe_using_dict().(src: &[u8], dst: &mut [u8], dict: &[u8]) -> Resultrust-analyzer cargo lzzzz 2.0.0 common/error/Result#<usize> { |
| 114 | let result = unsafe { |
| 115 | bindingrust-analyzer cargo lzzzz 2.0.0 lz4/binding/::LZ4_decompress_safe_usingDictrust-analyzer cargo lzzzz 2.0.0 LZ4_decompress_safe_usingDict().( |
| 116 | src.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 117 | dst.as_mut_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_mut_ptr().() as *mut c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 118 | src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 119 | dst.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 120 | dict.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 121 | dict.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 122 | ) |
| 123 | }; |
| 124 | if result rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().0 { |
| 125 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo lzzzz 2.0.0 common/error/Error#::newrust-analyzer cargo lzzzz 2.0.0 common/error/impl#[Error]new().(ErrorKindrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#::DecompressionFailedrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#DecompressionFailed#)) |
| 126 | } else { |
| 127 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result as usize) |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | pub fn decompress_safe_partial_using_dictrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/decompress_safe_partial_using_dict().( |
| 132 | src: &[u8], |
| 133 | dst: &mut [u8], |
| 134 | original_size: usize, |
| 135 | dict: &[u8], |
| 136 | ) -> Resultrust-analyzer cargo lzzzz 2.0.0 common/error/Result#<usize> { |
| 137 | let result = unsafe { |
| 138 | bindingrust-analyzer cargo lzzzz 2.0.0 lz4/binding/::LZ4_decompress_safe_partial_usingDictrust-analyzer cargo lzzzz 2.0.0 LZ4_decompress_safe_partial_usingDict().( |
| 139 | src.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 140 | dst.as_mut_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_mut_ptr().() as *mut c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 141 | src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 142 | original_size as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 143 | dst.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 144 | dict.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const c_charrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_char#, |
| 145 | dict.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as c_intrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/raw/c_int#, |
| 146 | ) |
| 147 | }; |
| 148 | if result rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().0 { |
| 149 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo lzzzz 2.0.0 common/error/Error#::newrust-analyzer cargo lzzzz 2.0.0 common/error/impl#[Error]new().(ErrorKindrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#::DecompressionFailedrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#DecompressionFailed#)) |
| 150 | } else { |
| 151 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result as usize) |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 156 | pub struct ExtStaterust-analyzer cargo lzzzz 2.0.0 lz4/block/api/ExtState#(RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<[u8]>>); |
| 157 | |
| 158 | impl ExtStaterust-analyzer cargo lzzzz 2.0.0 lz4/block/api/ExtState# { |
| 159 | fn newrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/impl#[ExtState]new().() -> Selfrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/impl#[ExtState] { |
| 160 | let size = size_of_staterust-analyzer cargo lzzzz 2.0.0 lz4/block/api/size_of_state().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1; |
| 161 | Selfrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/impl#[ExtState](RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/impl#[`RefCell<T>`]new().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; size].into_boxed_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]into_boxed_slice().())) |
| 162 | } |
| 163 | |
| 164 | pub fn withrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/impl#[ExtState]with().<F, R>(f: F) -> R |
| 165 | where |
| 166 | F: FnOncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnOnce#(&Selfrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/impl#[ExtState], bool) -> R, |
| 167 | { |
| 168 | EXT_STATErust-analyzer cargo lzzzz 2.0.0 lz4/block/api/EXT_STATE..withrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/local/impl#[`LocalKey<T>`]with().(|state| { |
| 169 | let reset = { |
| 170 | let mut state = state.borrow_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/impl#[`RefCell<T>`]borrow_mut().(); |
| 171 | let last = state.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1; |
| 172 | if state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().last]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().0 { |
| 173 | state[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().last]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = 1; |
| 174 | false |
| 175 | } else { |
| 176 | true |
| 177 | } |
| 178 | }; |
| 179 | |
| 180 | (f)(state, reset) |
| 181 | }) |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | impl Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref# for ExtStaterust-analyzer cargo lzzzz 2.0.0 lz4/block/api/ExtState# { |
| 186 | type Targetrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/impl#[ExtState][Deref]Target# = RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<[u8]>>; |
| 187 | |
| 188 | fn derefrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/impl#[ExtState][Deref]deref().(&self) -> &Selfrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/impl#[ExtState][Deref]::Targetrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#Target# { |
| 189 | &self.0rust-analyzer cargo lzzzz 2.0.0 lz4/block/api/ExtState#0. |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | thread_localrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/local/thread_local!!(static EXT_STATErust-analyzer cargo lzzzz 2.0.0 lz4/block/api/EXT_STATE.: ExtStaterust-analyzer cargo lzzzz 2.0.0 lz4/block/api/ExtState# = ExtStaterust-analyzer cargo lzzzz 2.0.0 lz4/block/api/ExtState#::newrust-analyzer cargo lzzzz 2.0.0 lz4/block/api/impl#[ExtState]new().()); |