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