Skip to main content

COConstruct

Trait COConstruct 

Source
pub trait COConstruct: COPrimitive + Sized {
    // Required methods
    fn try_new(
        start: Self::CoordType,
        end_excl: Self::CoordType,
    ) -> Option<Self>;
    unsafe fn new_unchecked(
        start: Self::CoordType,
        end_excl: Self::CoordType,
    ) -> Self;
}
Expand description

Construction capability for a valid closed-open interval.

Implementations must preserve the invariant:

start < end_excl

Required Methods§

Source

fn try_new(start: Self::CoordType, end_excl: Self::CoordType) -> Option<Self>

Constructs [start, end_excl), returning None for an empty or reversed interval.

Source

unsafe fn new_unchecked( start: Self::CoordType, end_excl: Self::CoordType, ) -> Self

Constructs [start, end_excl) without checking the interval invariant.

§Safety

The caller must guarantee that:

start < end_excl

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§