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;
34
35pub use render::*;
36pub use types::*;
37
38#[macro_export]
39macro_rules! rumtk_web_get_text_item {
40    ( $store:expr, $item:expr, $default:expr) => {{
41        match $store.get($item) {
42            Some(x) => x,
43            None => $default,
44        }
45    }};
46}
47
48#[macro_export]
49macro_rules! rumtk_web_get_param_eq {
50    ( $params:expr, $indx:expr, $comparison:expr, $default:expr ) => {{
51        match $params.get($indx) {
52            Some(x) => *x == $comparison,
53            None => $default,
54        }
55    }};
56}
57
58#[macro_export]
59macro_rules! rumtk_web_get_param {
60    ( $params:expr, $indx:expr, $default:expr ) => {{
61        match $params.get($indx) {
62            Some(x) => x.parse().unwrap_or($default),
63            None => $default,
64        }
65    }};
66}
67
68#[macro_export]
69macro_rules! rumtk_web_params_map {
70    ( $params:expr ) => {{
71        use $crate::RUMWebDataProxy;
72        RUMWebDataProxy::from($params)
73    }};
74}