Skip to main content

glycin_utils/api/
common.rs

1use std::time::Duration;
2
3#[cfg(feature = "external")]
4use zbus::zvariant::{Type, as_value};
5
6#[derive(Debug)]
7#[cfg_attr(
8    feature = "external",
9    derive(serde::Deserialize, serde::Serialize, Type)
10)]
11#[cfg_attr(feature = "external", zvariant(signature = "dict"))]
12#[cfg_attr(feature = "external", serde(default))]
13#[non_exhaustive]
14pub struct Limits {
15    #[cfg_attr(feature = "external", serde(with = "as_value"))]
16    pub max_dimensions: (u32, u32),
17    #[cfg_attr(feature = "external", serde(with = "as_value"))]
18    pub timeout: Duration,
19}
20
21impl Default for Limits {
22    fn default() -> Self {
23        Self {
24            max_dimensions: (u16::MAX as u32, u16::MAX as u32),
25            timeout: Duration::from_secs(60),
26        }
27    }
28}