mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 07:16:31 +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 {
|
macro_rules! progress {
|
||||||
($context:tt, $progress:expr) => {
|
($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(
|
$context.call_cb(
|
||||||
Event::CONFIGURE_PROGRESS,
|
Event::CONFIGURE_PROGRESS,
|
||||||
(if $progress < 0 {
|
$progress as uintptr_t,
|
||||||
0
|
|
||||||
} else if $progress > 1000 {
|
|
||||||
1000
|
|
||||||
} else {
|
|
||||||
$progress
|
|
||||||
}) as uintptr_t,
|
|
||||||
0 as uintptr_t,
|
0 as uintptr_t,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user