mirror of
https://github.com/chatmail/core.git
synced 2026-04-27 10:26:29 +03:00
simplify progress! macro
This commit is contained in:
committed by
holger krekel
parent
88a81f5737
commit
e05944c6cb
@@ -15,15 +15,13 @@ use crate::x::*;
|
||||
|
||||
macro_rules! progress {
|
||||
($context:tt, $progress:expr) => {
|
||||
assert!(
|
||||
$progress >= 0 && $progress <= 1000,
|
||||
"value in range 0..1000 expected with: 0=error, 1..999=progress, 1000=success"
|
||||
);
|
||||
$context.call_cb(
|
||||
Event::CONFIGURE_PROGRESS,
|
||||
(if $progress < 0 {
|
||||
0
|
||||
} else if $progress > 1000 {
|
||||
1000
|
||||
} else {
|
||||
$progress
|
||||
}) as uintptr_t,
|
||||
$progress as uintptr_t,
|
||||
0 as uintptr_t,
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user