surrealpatch/core/src/sql/v1/timeout.rs
Rushmore Mushambi 690dd55a86
Extract core lib into a standalone crate (#3423)
Co-authored-by: Gerard Guillemas Martos <gerard.guillemas@surrealdb.com>
2024-02-02 22:10:47 +00:00

23 lines
582 B
Rust

use crate::sql::duration::Duration;
use revision::revisioned;
use serde::{Deserialize, Serialize};
use std::fmt;
use std::ops::Deref;
#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Hash)]
#[revisioned(revision = 1)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
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)
}
}