substrate::geometry::union

Trait BoundingUnion

Source
pub trait BoundingUnion<T>
where T: ?Sized,
{ type Output; // Required method fn bounding_union(&self, other: &T) -> Self::Output; }
Expand description

Trait for calculating a shape that bounds the union of two geometric objects.

Required Associated Types§

Source

type Output

The type of the output shape representing the bounding union.

Required Methods§

Source

fn bounding_union(&self, other: &T) -> Self::Output

Calculates the bounding union of this shape with other.

§Example

let r1 = Rect::from_sides(0, 0, 100, 200);
let r2 = Rect::from_sides(-50, 20, 120, 160);
assert_eq!(r1.bounding_union(&r2), Rect::from_sides(-50, 0, 120, 200));

let r1 = Rect::from_sides(0, 0, 100, 200);
let r2 = None;
assert_eq!(r1.bounding_union(&r2), Rect::from_sides(0, 0, 100, 200));

Implementations on Foreign Types§

Source§

impl<L, T> BoundingUnion<T> for Shape<L>
where T: Bbox,

Source§

type Output = Rect

Source§

fn bounding_union(&self, other: &T) -> <Shape<L> as BoundingUnion<T>>::Output

Source§

impl<T> BoundingUnion<Option<T>> for Option<T>
where T: BoundingUnion<Option<T>, Output = T> + Clone,

Source§

type Output = Option<T>

Source§

fn bounding_union( &self, other: &Option<T>, ) -> <Option<T> as BoundingUnion<Option<T>>>::Output

Source§

impl<T> BoundingUnion<T> for Option<T>
where T: BoundingUnion<T, Output = T> + Clone,

Source§

type Output = T

Source§

fn bounding_union(&self, other: &T) -> <Option<T> as BoundingUnion<T>>::Output

Implementors§

Source§

impl BoundingUnion<Rect> for Rect

Source§

impl BoundingUnion<Span> for Span

Source§

impl<T> BoundingUnion<Option<T>> for T
where T: BoundingUnion<T, Output = T> + Clone,

Source§

impl<T> BoundingUnion<T> for substrate::geometry::shape::Shape
where T: Bbox,