pub struct ZTime<B: DateBackend> { /* private fields */ }chrono or jiff or time only.Expand description
Schema for a time of day: HH:MM:SS[.fraction] (no offset) into the
backend’s time type (chrono::NaiveTime, jiff::civil::Time or
time::Time).
Created via vld::chrono::time(), vld::jiff::time() or vld::time::time()
(or vld::time_of_day() when exactly one backend is enabled). Malformed
input fails with invalid_date (kind time); bounds with too_small /
too_big (origin time). JSON Schema: a pattern for HH:MM:SS[.frac]
(format: time would require an offset).
Implementations§
Source§impl<B: DateBackend> ZTime<B>
impl<B: DateBackend> ZTime<B>
Sourcepub fn type_error(self, msg: impl Into<String>) -> Self
pub fn type_error(self, msg: impl Into<String>) -> Self
Set a custom error message for type mismatch (non-string input).
Sourcepub fn min(self, time: &str) -> Self
pub fn min(self, time: &str) -> Self
Earliest time (inclusive). Accepts "HH:MM:SS[.frac]"; panics on an invalid literal.
Sourcepub fn min_time(self, time: B::Time) -> Self
pub fn min_time(self, time: B::Time) -> Self
Earliest time (inclusive) from a backend time value.
Trait Implementations§
Source§impl<B: DateBackend> CollectNestedSchemas for ZTime<B>
impl<B: DateBackend> CollectNestedSchemas for ZTime<B>
Source§fn collect_nested_schemas(&self, _out: &mut Vec<NestedSchemaEntry>)
fn collect_nested_schemas(&self, _out: &mut Vec<NestedSchemaEntry>)
openapi only._out (for components.schemas).Source§impl<B: DateBackend> Default for ZTime<B>
impl<B: DateBackend> Default for ZTime<B>
Source§impl<B: DateBackend> JsonSchema for ZTime<B>
{"type": "string", "format": "partial-time", "pattern": ...} — RFC 3339
partial-time (not format: time, which requires an offset; validators
ignore the unknown format and use the pattern); min/max become
formatMinimum/formatMaximum.
impl<B: DateBackend> JsonSchema for ZTime<B>
{"type": "string", "format": "partial-time", "pattern": ...} — RFC 3339
partial-time (not format: time, which requires an offset; validators
ignore the unknown format and use the pattern); min/max become
formatMinimum/formatMaximum.
Source§fn json_schema(&self) -> Value
fn json_schema(&self) -> Value
openapi only.Source§fn is_required(&self) -> bool
fn is_required(&self) -> bool
openapi only.required array. Read moreSource§impl<B: DateBackend> VldSchema for ZTime<B>
impl<B: DateBackend> VldSchema for ZTime<B>
Source§type Output = <B as DateBackend>::Time
type Output = <B as DateBackend>::Time
Source§fn parse_value(&self, value: &Value) -> Result<B::Time, VldError>
fn parse_value(&self, value: &Value) -> Result<B::Time, VldError>
serde_json::Value.Source§fn parse_missing(&self) -> Result<Self::Output, VldError>
fn parse_missing(&self) -> Result<Self::Output, VldError>
Source§fn parse<I: VldInput + ?Sized>(
&self,
input: &I,
) -> Result<Self::Output, VldError>
fn parse<I: VldInput + ?Sized>( &self, input: &I, ) -> Result<Self::Output, VldError>
serde_json::Value, etc.)Source§fn validate<T: Serialize>(&self, value: &T) -> Result<Self::Output, VldError>
fn validate<T: Serialize>(&self, value: &T) -> Result<Self::Output, VldError>
Source§fn is_valid<T: Serialize>(&self, value: &T) -> bool
fn is_valid<T: Serialize>(&self, value: &T) -> bool
Source§fn optional(self) -> ZOptional<Self>
fn optional(self) -> ZOptional<Self>
None.Source§fn with_default(self, value: Self::Output) -> ZDefault<Self>
fn with_default(self, value: Self::Output) -> ZDefault<Self>
Source§fn blank_as(self, value: Self::Output) -> ZDefault<Self>
fn blank_as(self, value: Self::Output) -> ZDefault<Self>
with_default, and a blank string (empty or
whitespace only) also becomes value: legacy stores that write ""
or null for “unset”. Read moreSource§fn refine<F>(self, check: F, message: &str) -> ZRefine<Self, F>
fn refine<F>(self, check: F, message: &str) -> ZRefine<Self, F>
Source§fn rule_msg<R>(self, rule: R, msg: impl Into<String>) -> ZRule<Self, R>
fn rule_msg<R>(self, rule: R, msg: impl Into<String>) -> ZRule<Self, R>
rule with a custom error message.Source§fn try_transform<F, U, E>(self, f: F) -> ZTryTransform<Self, F, U>
fn try_transform<F, U, E>(self, f: F) -> ZTryTransform<Self, F, U>
Err becomes a
validation issue (Custom { code: "transform" }, message = the error). Read moreSource§fn transform<F, U>(self, f: F) -> ZTransform<Self, F, U>
fn transform<F, U>(self, f: F) -> ZTransform<Self, F, U>
Source§fn catch(self, fallback: Self::Output) -> ZCatch<Self>
fn catch(self, fallback: Self::Output) -> ZCatch<Self>
Source§fn pipe<S: VldSchema>(self, next: S) -> ZPipe<Self, S>
fn pipe<S: VldSchema>(self, next: S) -> ZPipe<Self, S>
Source§fn describe(self, description: &str) -> ZDescribe<Self>
fn describe(self, description: &str) -> ZDescribe<Self>
Source§fn super_refine<F>(self, check: F) -> ZSuperRefine<Self, F>
fn super_refine<F>(self, check: F) -> ZSuperRefine<Self, F>
Source§fn or<B: VldSchema>(self, other: B) -> ZUnion2<Self, B>
fn or<B: VldSchema>(self, other: B) -> ZUnion2<Self, B>
Either<Self::Output, B::Output>.Source§fn and<B: VldSchema>(self, other: B) -> ZIntersection<Self, B>
fn and<B: VldSchema>(self, other: B) -> ZIntersection<Self, B>
Auto Trait Implementations§
impl<B> Forget for ZTime<B>
impl<B> Freeze for ZTime<B>
impl<B> RefUnwindSafe for ZTime<B>
impl<B> Send for ZTime<B>
impl<B> Sync for ZTime<B>
impl<B> Unpin for ZTime<B>
impl<B> UnsafeUnpin for ZTime<B>
impl<B> UnwindSafe for ZTime<B>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DynSchema for T
impl<T> DynSchema for T
Source§fn dyn_parse(&self, value: &Value) -> Result<Value, VldError>
fn dyn_parse(&self, value: &Value) -> Result<Value, VldError>
value and return the output serialized back to JSON.Source§fn dyn_parse_missing(&self) -> Result<Value, VldError>
fn dyn_parse_missing(&self) -> Result<Value, VldError>
VldSchema::parse_missing of the erased schema.Source§fn dyn_json_schema(&self) -> Value
fn dyn_json_schema(&self) -> Value
openapi only.Source§fn dyn_is_required(&self) -> bool
fn dyn_is_required(&self) -> bool
openapi only.required array.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().