# Struct libreda_db::layout::prelude::PointString

``````pub struct PointString<T> {
pub points: Vec<Point<T>, Global>,
}``````
Expand description

A point string is a finite sequence of points. TODO: Implement `Deref` for accessing the list of points.

## Fields

`points: Vec<Point<T>, Global>`

The points defining this point string.

## Implementations

Get the number of vertices.

Check if string has zero length.

Create new point string by taking vertices from a type that implements `Into<PointString<T>>`.

Shortcut for `self.points.iter()`.

Get the sequence of edges of the point string starting from the first point to the last.

##### Examples
``````use iron_shapes::point_string::PointString;
use iron_shapes::edge::Edge;
let coords = vec![(0, 0), (1, 0), (2, 0)];

let point_string = PointString::new(coords);

let edges: Vec<_> = point_string.edges().collect();

assert_eq!(edges, vec![Edge::new((0, 0), (1, 0)), Edge::new((1, 0), (2, 0))]);``````

Same as `edges` but in reverse order. Get the sequence of edges of the point string starting from the last point to the first.

##### Examples
``````use iron_shapes::point_string::PointString;
use iron_shapes::edge::Edge;
let coords = vec![(0, 0), (1, 0), (2, 0)];

let point_string = PointString::new(coords);

let edges: Vec<_> = point_string.edges_reversed().collect();

assert_eq!(edges, vec![Edge::new((2, 0), (1, 0)), Edge::new((1, 0), (0, 0))]);``````

Compute geometrical length of the path defined by the point string.

##### Examples
``````use iron_shapes::point_string::PointString;
let coords = vec![(0, 0), (1, 0), (2, 0)];

let point_string = PointString::new(coords);

assert_eq!(point_string.path_length::<f64>(), 2.0);``````

## 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

Deserialize this value from the given Serde deserializer. Read more

Create a point string from something that can be turned into an iterator of values convertible to `Point`s.

Converts to this type from the input type.

Create a point string from a iterator of values convertible to `Point`s.

Creates a value from an iterator. Read more

Feeds this value into the given `Hasher`. Read more

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

Point wise transformation.

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

This method tests for `!=`.

Serialize this value into the given Serde serializer. Read more

Compute the bounding box of all the points in this string. Returns `None` if the string is empty.

##### Examples
``````use iron_shapes::point_string::PointString;
use iron_shapes::traits::TryBoundingBox;
use iron_shapes::rect::Rect;
let coords = vec![(0, 0), (1, 0), (2, 1), (-1, -3)];

let point_string = PointString::new(coords);

assert_eq!(point_string.try_bounding_box(), Some(Rect::new((2, 1), (-1, -3))));``````

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

## 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.

Return the geometrical object mirrored at the `x` axis.

Return the geometrical object mirrored at the `y` axis.

Rotate the geometrical shape by a multiple of 90 degrees.

Scale the geometrical shape. Scaling center is the origin `(0, 0)`.

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

Translate the geometrical object by a vector `v`.

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.