// Don't check for `None`, as the error from year-month-day will always take priority. iflet Some(ParsedItem(input, ordinal)) = dayo(input) {
*parsed = parsed
.with_year(year)
.ok_or(InvalidComponent("year"))?
.with_ordinal(ordinal)
.ok_or(InvalidComponent("ordinal"))?; return Ok(input);
}
let parsed_week_weekday = (|| { let input = ascii_char::<b'W'>(input)
.ok_or((false, InvalidLiteral))?
.into_inner(); let ParsedItem(mut input, week) =
week(input).ok_or((true, InvalidComponent("week")))?; if extended_kind.is_extended() {
input = ascii_char::<b'-'>(input)
.ok_or((true, InvalidLiteral))?
.into_inner();
} let ParsedItem(input, weekday) =
dayk(input).ok_or((true, InvalidComponent("weekday")))?;
Ok(ParsedItem(input, (week, weekday)))
})(); match parsed_week_weekday {
Ok(ParsedItem(input, (week, weekday))) => {
*parsed = parsed
.with_iso_year(year)
.ok_or(InvalidComponent("year"))?
.with_iso_week_number(week)
.ok_or(InvalidComponent("week"))?
.with_weekday(weekday)
.ok_or(InvalidComponent("weekday"))?; return Ok(input);
}
Err((false, _err)) => {} // This error is more accurate than the one from year-month-day.
Err((true, err)) => ret_error = err,
}
Err(ret_error.into())
}
}
// Basic: ["T"][hour][min][sec] // Extended: ["T"][hour][":"][min][":"][sec] // Reduced precision: components after [hour] (including their preceding separator) can be // omitted. ["T"] can be omitted if there is no date present. /// Parse a time in the basic or extended format. Reduced precision is permitted. pub(crate) fn parse_time<'a>(
parsed: &'a mut Parsed,
extended_kind: &'a mut ExtendedKind,
date_is_present: bool,
) -> impl FnMut(&[u8]) -> Result<&[u8], error::Parse> + 'a { move |mut input| { if date_is_present {
input = ascii_char::<b'T'>(input)
.ok_or(InvalidLiteral)?
.into_inner();
}
let ParsedItem(mut input, hour) = float(input).ok_or(InvalidComponent("hour"))?; match hour {
(hour, None) => parsed.set_hour_24(hour).ok_or(InvalidComponent("hour"))?,
(hour, Some(fractional_part)) => {
*parsed = parsed
.with_hour_24(hour)
.ok_or(InvalidComponent("hour"))?
.with_minute((fractional_part * Second::per(Minute) as f64) as _)
.ok_or(InvalidComponent("minute"))?
.with_second(
(fractional_part * Second::per(Hour) as f64 % Minute::per(Hour) as f64) as _,
)
.ok_or(InvalidComponent("second"))?
.with_subsecond(
(fractional_part * Nanosecond::per(Hour) as f64
% Nanosecond::per(Second) as f64) as _,
)
.ok_or(InvalidComponent("subsecond"))?; return Ok(input);
}
};
match min(input) {
Some(ParsedItem(new_input, min)) => {
input = new_input;
parsed
.set_offset_minute_signed(if sign == b'-' {
-min.cast_signed()
} else {
min.cast_signed()
})
.ok_or(InvalidComponent("offset minute"))?;
}
None => { // Omitted offset minute is assumed to be zero.
parsed.set_offset_minute_signed(0);
}
}
// If `:` was present, the format has already been set to extended. As such, this call // will do nothing in that case. If there wasn't `:` but minutes were // present, we know it's the basic format. Do not use `?` on the call, as // returning `None` is valid behavior.
extended_kind.coerce_basic();
Ok(input)
}
}
}
/// Round wrapper that uses hardware implementation if `std` is available, falling back to manual /// implementation for `no_std` fn round(value: f64) -> f64 { #[cfg(feature = "std")]
{
value.round()
} #[cfg(not(feature = "std"))]
{
round_impl(value)
}
}
let f = value % 1.; if f < 0.5 { value - f } else { value - f + 1. }
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.18Bemerkung:
(vorverarbeitet am 2026-06-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.