Skip to main content

rumtk_web/utils/
mod.rs

1/*
2 * rumtk attempts to implement HL7 and medical protocols for interoperability in medicine.
3 * This toolkit aims to be reliable, simple, performant, and standards compliant.
4 * Copyright (C) 2025  Luis M. Santos, M.D. <lsantos@medicalmasses.com>
5 * Copyright (C) 2025  Ethan Dixon
6 * Copyright (C) 2025  MedicalMasses L.L.C. <contact@medicalmasses.com>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 */
21pub use rumtk_core::strings::{RUMString, RUMStringConversions};
22
23pub mod app;
24pub mod conf;
25pub mod defaults;
26pub mod form_data;
27pub mod jobs;
28pub mod matcher;
29pub mod packaging;
30pub mod render;
31pub mod response;
32pub mod testdata;
33pub mod types;
34pub mod conversions;
35
36pub use render::*;
37pub use types::*;
38
39#[macro_export]
40macro_rules! rumtk_web_get_text_item {
41    ( $store:expr, $item:expr, $default:expr) => {{
42        match $store.get($item) {
43            Some(x) => x,
44            None => $default,
45        }
46    }};
47}
48
49#[macro_export]
50macro_rules! rumtk_web_get_param_eq {
51    ( $params:expr, $indx:expr, $comparison:expr, $default:expr ) => {{
52        match $params.get($indx) {
53            Some(x) => *x == $comparison,
54            None => $default,
55        }
56    }};
57}
58
59#[macro_export]
60macro_rules! rumtk_web_get_param {
61    ( $params:expr, $indx:expr, $default:expr ) => {{
62        match $params.get($indx) {
63            Some(x) => x.parse().unwrap_or($default),
64            None => $default,
65        }
66    }};
67}
68
69#[macro_export]
70macro_rules! rumtk_web_params_map {
71    ( $params:expr ) => {{
72        use $crate::RUMWebDataProxy;
73        RUMWebDataProxy::from($params)
74    }};
75}