pub trait PreciseAbsBound {
type PrecisedBoundOutput;
// Required methods
fn precise(
&self,
tz: TimeZone,
precision: Precision,
) -> Self::PrecisedBoundOutput;
fn precise_with_base_time(
&self,
tz: TimeZone,
precision: Precision,
base: Timestamp,
) -> Self::PrecisedBoundOutput;
}Expand description
Ability to precise absolute bounds
The precision itself is defined by Precision.
See module documentation for more info.
§Examples
let bound = AbsFiniteBoundPos::new_with_incl(
"2025-01-01 08:24:41[Europe/Oslo]"
.parse::<Zoned>()?
.timestamp(),
BoundInclusivity::Exclusive,
)
.to_start_bound();
assert_eq!(
bound.precise(
TimeZone::get("Europe/Oslo")?,
Precision::new(Duration::from_mins(5), PrecisionMode::ToFuture)?,
),
Ok(AbsFiniteBoundPos::new_with_incl(
"2025-01-01 08:25:00[Europe/Oslo]"
.parse::<Zoned>()?
.timestamp(),
BoundInclusivity::Exclusive,
)
.to_start_bound()),
);Required Associated Types§
Sourcetype PrecisedBoundOutput
type PrecisedBoundOutput
Type of the resulting precised bound
Required Methods§
Sourcefn precise(
&self,
tz: TimeZone,
precision: Precision,
) -> Self::PrecisedBoundOutput
fn precise( &self, tz: TimeZone, precision: Precision, ) -> Self::PrecisedBoundOutput
Precises the bound with the given precision
See Precision::precise_time for more information.
§Examples
let bound = AbsFiniteBoundPos::new_with_incl(
"2025-01-01 08:24:41[Europe/Oslo]"
.parse::<Zoned>()?
.timestamp(),
BoundInclusivity::Exclusive,
)
.to_start_bound();
assert_eq!(
bound.precise(
TimeZone::get("Europe/Oslo")?,
Precision::new(Duration::from_mins(5), PrecisionMode::ToFuture)?,
),
Ok(AbsFiniteBoundPos::new_with_incl(
"2025-01-01 08:25:00[Europe/Oslo]"
.parse::<Zoned>()?
.timestamp(),
BoundInclusivity::Exclusive,
)
.to_start_bound()),
);Sourcefn precise_with_base_time(
&self,
tz: TimeZone,
precision: Precision,
base: Timestamp,
) -> Self::PrecisedBoundOutput
fn precise_with_base_time( &self, tz: TimeZone, precision: Precision, base: Timestamp, ) -> Self::PrecisedBoundOutput
Precises the bound with the given precision and base time
See Precision::precise_time_with_base_time for more information.
§Examples
let bound = AbsFiniteBoundPos::new_with_incl(
"2025-01-01 08:24:41[Europe/Oslo]"
.parse::<Zoned>()?
.timestamp(),
BoundInclusivity::Exclusive,
)
.to_start_bound();
assert_eq!(
bound.precise_with_base_time(
TimeZone::get("Europe/Oslo")?,
Precision::new(Duration::from_mins(7), PrecisionMode::ToFuture)?,
"2025-01-01 08:00:00[Europe/Oslo]"
.parse::<Zoned>()?
.timestamp(),
),
Ok(AbsFiniteBoundPos::new_with_incl(
"2025-01-01 08:28:00[Europe/Oslo]"
.parse::<Zoned>()?
.timestamp(),
BoundInclusivity::Exclusive,
)
.to_start_bound()),
);Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".