2023-11-18 13:56:13 +00:00
|
|
|
use crate::sql::duration::Duration;
|
2023-08-17 18:03:46 +00:00
|
|
|
use revision::revisioned;
|
2020-06-29 15:36:01 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use std::fmt;
|
2022-05-04 21:45:00 +00:00
|
|
|
use std::ops::Deref;
|
2020-06-29 15:36:01 +00:00
|
|
|
|
2023-08-17 18:03:46 +00:00
|
|
|
#[revisioned(revision = 1)]
|
2024-04-17 14:27:55 +00:00
|
|
|
#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Hash)]
|
2024-01-09 15:34:52 +00:00
|
|
|
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
2024-04-02 20:12:08 +00:00
|
|
|
#[non_exhaustive]
|
2022-05-04 21:45:00 +00:00
|
|
|
pub struct Timeout(pub Duration);
|
|
|
|
|
|
|
|
impl Deref for Timeout {
|
|
|
|
type Target = Duration;
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
&self.0
|
|
|
|
}
|
2020-06-29 15:36:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl fmt::Display for Timeout {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
2022-05-04 21:45:00 +00:00
|
|
|
write!(f, "TIMEOUT {}", self.0)
|
2020-06-29 15:36:01 +00:00
|
|
|
}
|
|
|
|
}
|