feat(cache): Added offline!() macro to manage online and offline function distinctions

See fetch_library command for example
This commit is contained in:
quexeky
2025-01-30 12:11:20 +11:00
parent bb23e88ead
commit f33ca95bdf
3 changed files with 6 additions and 3 deletions

View File

@ -2,10 +2,11 @@
#[macro_export]
macro_rules! offline {
($var:expr, $func1:expr, $func2:expr, $( $arg:expr ),* ) => {
if borrow_db_checked().settings.offline || state.{
if crate::borrow_db_checked().settings.force_offline || $var.lock().unwrap().status == crate::AppStatus::Offline {
$func1( $( $arg ), *)
} else {
$func2( $( $arg ), *)
}
};
}
}