style(rust): format migrated policy bridges
Apply the repository formatter to the dictionary-size and MT input-publication bridges introduced in the preceding atomic refactors. The change is formatting-only and keeps the semantic seams independently reviewable. Test Plan: cargo +nightly fmt --manifest-path rust/Cargo.toml --all
This commit is contained in:
@@ -20,10 +20,9 @@ use crate::zstd_compress_params::{
|
|||||||
ZSTD_rust_params_allocateChainTable, ZSTD_rust_params_defaultCLevel,
|
ZSTD_rust_params_allocateChainTable, ZSTD_rust_params_defaultCLevel,
|
||||||
ZSTD_rust_params_estimateCDictWorkspaceSize, ZSTD_rust_params_getCParams,
|
ZSTD_rust_params_estimateCDictWorkspaceSize, ZSTD_rust_params_getCParams,
|
||||||
ZSTD_rust_params_getCParamsInternal, ZSTD_rust_params_getParamsInternal,
|
ZSTD_rust_params_getCParamsInternal, ZSTD_rust_params_getParamsInternal,
|
||||||
ZSTD_rust_params_resolveRowMatchFinderMode,
|
ZSTD_rust_params_resolveRowMatchFinderMode, ZSTD_rust_params_rowMatchFinderUsed,
|
||||||
ZSTD_rust_params_rowMatchFinderUsed, ZSTD_rust_params_shouldAttachDict,
|
ZSTD_rust_params_shouldAttachDict, ZSTD_CONTENTSIZE_UNKNOWN, ZSTD_RUST_CPM_CREATE_CDICT,
|
||||||
ZSTD_CONTENTSIZE_UNKNOWN, ZSTD_RUST_CPM_CREATE_CDICT, ZSTD_RUST_CPM_NO_ATTACH_DICT,
|
ZSTD_RUST_CPM_NO_ATTACH_DICT, ZSTD_RUST_PS_AUTO,
|
||||||
ZSTD_RUST_PS_AUTO,
|
|
||||||
};
|
};
|
||||||
use crate::zstd_compress_params_api::ZSTD_CCtx_params;
|
use crate::zstd_compress_params_api::ZSTD_CCtx_params;
|
||||||
use crate::zstd_compress_stats::{
|
use crate::zstd_compress_stats::{
|
||||||
@@ -56,12 +55,8 @@ const fn dictionary_content_reservation_size(dict_size: usize) -> usize {
|
|||||||
dict_size.wrapping_add(mask) & !mask
|
dict_size.wrapping_add(mask) & !mask
|
||||||
}
|
}
|
||||||
|
|
||||||
type EstimateCDictSizeAdvancedFn = unsafe extern "C" fn(
|
type EstimateCDictSizeAdvancedFn =
|
||||||
*mut c_void,
|
unsafe extern "C" fn(*mut c_void, usize, ZSTD_compressionParameters, c_int) -> usize;
|
||||||
usize,
|
|
||||||
ZSTD_compressionParameters,
|
|
||||||
c_int,
|
|
||||||
) -> usize;
|
|
||||||
|
|
||||||
/// Projection for the scalar policy wrapper of `ZSTD_estimateCDictSize()`.
|
/// Projection for the scalar policy wrapper of `ZSTD_estimateCDictSize()`.
|
||||||
///
|
///
|
||||||
@@ -79,8 +74,7 @@ const _: () = {
|
|||||||
assert!(offset_of!(ZSTD_rust_estimateCDictSizeState, callback_context) == 0);
|
assert!(offset_of!(ZSTD_rust_estimateCDictSizeState, callback_context) == 0);
|
||||||
assert!(offset_of!(ZSTD_rust_estimateCDictSizeState, exclusion_mask) == size_of::<usize>());
|
assert!(offset_of!(ZSTD_rust_estimateCDictSizeState, exclusion_mask) == size_of::<usize>());
|
||||||
assert!(
|
assert!(
|
||||||
offset_of!(ZSTD_rust_estimateCDictSizeState, estimate_advanced)
|
offset_of!(ZSTD_rust_estimateCDictSizeState, estimate_advanced) == 2 * size_of::<usize>()
|
||||||
== 2 * size_of::<usize>()
|
|
||||||
);
|
);
|
||||||
assert!(size_of::<ZSTD_rust_estimateCDictSizeState>() == size_of::<[usize; 3]>());
|
assert!(size_of::<ZSTD_rust_estimateCDictSizeState>() == size_of::<[usize; 3]>());
|
||||||
};
|
};
|
||||||
@@ -107,12 +101,7 @@ pub unsafe extern "C" fn ZSTD_rust_estimateCDictSize(
|
|||||||
unsafe { *state.exclusion_mask },
|
unsafe { *state.exclusion_mask },
|
||||||
);
|
);
|
||||||
unsafe {
|
unsafe {
|
||||||
(state.estimate_advanced)(
|
(state.estimate_advanced)(state.callback_context, dict_size, cparams, ZSTD_DLM_BY_COPY)
|
||||||
state.callback_context,
|
|
||||||
dict_size,
|
|
||||||
cparams,
|
|
||||||
ZSTD_DLM_BY_COPY,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2683,9 +2672,7 @@ mod tests {
|
|||||||
let exclusion_mask = 0;
|
let exclusion_mask = 0;
|
||||||
let state = estimate_cdict_size_test_state(&mut probe, &exclusion_mask);
|
let state = estimate_cdict_size_test_state(&mut probe, &exclusion_mask);
|
||||||
|
|
||||||
let result = unsafe {
|
let result = unsafe { ZSTD_rust_estimateCDictSize(&state, dict_size, compression_level) };
|
||||||
ZSTD_rust_estimateCDictSize(&state, dict_size, compression_level)
|
|
||||||
};
|
|
||||||
|
|
||||||
assert_eq!(result, probe.result);
|
assert_eq!(result, probe.result);
|
||||||
assert_eq!(probe.events, ["advanced"]);
|
assert_eq!(probe.events, ["advanced"]);
|
||||||
|
|||||||
+11
-22
@@ -1600,9 +1600,7 @@ pub struct ZSTDMT_streamCreateJobResult {
|
|||||||
|
|
||||||
const _: () = {
|
const _: () = {
|
||||||
assert!(offset_of!(ZSTDMT_streamCreateJobResult, result) == 0);
|
assert!(offset_of!(ZSTDMT_streamCreateJobResult, result) == 0);
|
||||||
assert!(
|
assert!(offset_of!(ZSTDMT_streamCreateJobResult, inBuffActive) == size_of::<usize>());
|
||||||
offset_of!(ZSTDMT_streamCreateJobResult, inBuffActive) == size_of::<usize>()
|
|
||||||
);
|
|
||||||
assert!(size_of::<ZSTDMT_streamCreateJobResult>() == 2 * size_of::<usize>());
|
assert!(size_of::<ZSTDMT_streamCreateJobResult>() == 2 * size_of::<usize>());
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1628,12 +1626,11 @@ pub type ZSTDMT_streamTryGetInputRangeFn = unsafe extern "C" fn(
|
|||||||
opaque: *mut c_void,
|
opaque: *mut c_void,
|
||||||
projection: *mut ZSTDMT_streamInputRangeProjection,
|
projection: *mut ZSTDMT_streamInputRangeProjection,
|
||||||
) -> c_int;
|
) -> c_int;
|
||||||
pub type ZSTDMT_streamCreateJobFn =
|
pub type ZSTDMT_streamCreateJobFn = unsafe extern "C" fn(
|
||||||
unsafe extern "C" fn(
|
opaque: *mut c_void,
|
||||||
opaque: *mut c_void,
|
src_size: usize,
|
||||||
src_size: usize,
|
end: c_uint,
|
||||||
end: c_uint,
|
) -> ZSTDMT_streamCreateJobResult;
|
||||||
) -> ZSTDMT_streamCreateJobResult;
|
|
||||||
pub type ZSTDMT_streamFlushProducedFn = unsafe extern "C" fn(
|
pub type ZSTDMT_streamFlushProducedFn = unsafe extern "C" fn(
|
||||||
opaque: *mut c_void,
|
opaque: *mut c_void,
|
||||||
output_dst: *mut c_void,
|
output_dst: *mut c_void,
|
||||||
@@ -3553,10 +3550,7 @@ where
|
|||||||
ERROR(ZstdErrorCode::Generic),
|
ERROR(ZstdErrorCode::Generic),
|
||||||
input_pos,
|
input_pos,
|
||||||
output_pos,
|
output_pos,
|
||||||
publishable_in_buff_filled(
|
publishable_in_buff_filled(input_range.bufferStart, input_range.bufferFilled),
|
||||||
input_range.bufferStart,
|
|
||||||
input_range.bufferFilled,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
if sync_point.toLoad > available
|
if sync_point.toLoad > available
|
||||||
@@ -3567,10 +3561,7 @@ where
|
|||||||
ERROR(ZstdErrorCode::Generic),
|
ERROR(ZstdErrorCode::Generic),
|
||||||
input_pos,
|
input_pos,
|
||||||
output_pos,
|
output_pos,
|
||||||
publishable_in_buff_filled(
|
publishable_in_buff_filled(input_range.bufferStart, input_range.bufferFilled),
|
||||||
input_range.bufferStart,
|
|
||||||
input_range.bufferFilled,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8375,11 +8366,9 @@ mod tests {
|
|||||||
inBuffActive: 0,
|
inBuffActive: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|_dst, _size, output_pos, _block_to_flush, _end| {
|
|_dst, _size, output_pos, _block_to_flush, _end| ZSTDMT_streamFlushResult {
|
||||||
ZSTDMT_streamFlushResult {
|
result: 0,
|
||||||
result: 0,
|
outputPos: output_pos,
|
||||||
outputPos: output_pos,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|_context, _input, _projection| panic!("no synchronization scan expected"),
|
|_context, _input, _projection| panic!("no synchronization scan expected"),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user