surrealpatch/core/src/sql/timeout.rs
Raphael Darley 4c8c9f6c8a
Info structure refactor (#3886)
Co-authored-by: Micha de Vries <micha@devrie.sh>
2024-04-17 15:27:55 +01:00

24 lines
600 B
Rust

use crate::sql::duration::Duration;
use revision::revisioned;
use serde::{Deserialize, Serialize};
use std::fmt;
use std::ops::Deref;
#[revisioned(revision = 1)]
#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[non_exhaustive]
pub struct Timeout(pub Duration);
impl Deref for Timeout {
type Target = Duration;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl fmt::Display for Timeout {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "TIMEOUT {}", self.0)
}
}