pub trait Complementable {
type Output;
// Required method
fn complement(&self) -> ComplementResult<Self::Output>;
}Expand description
Capacity to get the complementary intervals
§Examples
let interval = AbsBoundPair::new(
AbsFiniteBoundPos::new_with_incl(
"2025-01-01 08:00:00[Europe/Oslo]".parse::<Zoned>()?.timestamp(),
BoundInclusivity::Exclusive,
).to_start_bound(),
AbsFiniteBoundPos::new(
"2025-01-01 16:00:00[Europe/Oslo]".parse::<Zoned>()?.timestamp(),
).to_end_bound(),
);
assert_eq!(
interval.complement(),
ComplementResult::Split(
EmptiableAbsBoundPair::Bound(AbsBoundPair::new(
AbsStartBound::InfinitePast,
AbsFiniteBoundPos::new(
"2025-01-01 08:00:00[Europe/Oslo]".parse::<Zoned>()?.timestamp(),
).to_end_bound(),
)),
EmptiableAbsBoundPair::Bound(AbsBoundPair::new(
AbsFiniteBoundPos::new_with_incl(
"2025-01-01 16:00:00[Europe/Oslo]".parse::<Zoned>()?.timestamp(),
BoundInclusivity::Exclusive,
).to_start_bound(),
AbsEndBound::InfiniteFuture,
)),
),
);Required Associated Types§
Required Methods§
Sourcefn complement(&self) -> ComplementResult<Self::Output>
fn complement(&self) -> ComplementResult<Self::Output>
Returns the complementary interval(s) of self
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".