pub struct Timeout(/* private fields */);Expand description
Timeout value in milliseconds.
use solti_model::Timeout;
let timeout = Timeout::new(5_000).unwrap();
assert_eq!(timeout.as_millis(), 5_000);
let timeout = Timeout::new(10_000).unwrap();
assert_eq!(format!("{timeout}"), "10000ms");Implementations§
Source§impl Timeout
impl Timeout
Sourcepub fn new(ms: u64) -> ModelResult<Self>
pub fn new(ms: u64) -> ModelResult<Self>
Creates a timeout value.
§Errors
Returns ModelError::Invalid when ms is zero.
§Example
use solti_model::Timeout;
let timeout = Timeout::new(5_000).unwrap();
assert_eq!(timeout.as_millis(), 5_000);Trait Implementations§
impl Copy for Timeout
Source§impl<'de> Deserialize<'de> for Timeout
impl<'de> Deserialize<'de> for Timeout
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Timeout
Source§impl JsonSchema for Timeout
impl JsonSchema for Timeout
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl Ord for Timeout
impl Ord for Timeout
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Timeout
impl PartialOrd for Timeout
impl StructuralPartialEq for Timeout
Auto Trait Implementations§
impl Freeze for Timeout
impl RefUnwindSafe for Timeout
impl Send for Timeout
impl Sync for Timeout
impl Unpin for Timeout
impl UnsafeUnpin for Timeout
impl UnwindSafe for Timeout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more