pub enum Geometry<T> {
    Point(Point<T>),
    Edge(Edge<T>),
    Rect(Rect<T>),
    SimplePolygon(SimplePolygon<T>),
    SimpleRPolygon(SimpleRPolygon<T>),
    Polygon(Polygon<T>),
    Path(Path<T>),
    Text(Text<T>),
}
Expand description

Abstracted geometrical shape.

Variants

Point(Point<T>)

Point.

Edge(Edge<T>)

Edge.

Rect(Rect<T>)

Rect.

SimplePolygon(SimplePolygon<T>)

SimplePolygon.

SimpleRPolygon(SimpleRPolygon<T>)

SimpleRPolygon.

Polygon(Polygon<T>)

Polygon.

Path(Path<T>)

Path.

Text(Text<T>)

Text.

Implementations

Create a transformed copy of the geometric object.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Area calculation.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Convert a geometry into a polygon.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Convert a geometry into a polygon.

The coordinate type must implement NumCast because there is currently no way to convert a Path into a polygon without converting it to a float type first.

Examples
use iron_shapes::prelude::*;
let rect = Rect::new((0, 0), (1, 2));
// Convert the rectangle to a `Geometry`.
let g: Geometry<_> = rect.into();
assert_eq!(g.to_polygon(), rect.to_polygon())

Calculate the bounding box of this geometrical shape by calling the bounding box method of the concrete type.

Output type of the cast. This is likely the same geometrical type just with other coordinate types. Read more

Try to cast to target data type. Read more

Cast to target data type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.