[−][src]Struct myelin_geometry::PolygonBuilder
Polygon
factory, which can be used in order to configure
the properties of a new polygon.
Methods can be chained on it in order to configure it.
Examples
use myelin_geometry::PolygonBuilder; let builder = PolygonBuilder::default();
Implementations
impl PolygonBuilder
[src]
pub fn vertex(mut self: Self, x: f64, y: f64) -> Self
[src]
Adds a vertex to the polygon
Examples
use myelin_geometry::PolygonBuilder; let unfinished_builder = PolygonBuilder::default() .vertex(-50.0, -50.0) .vertex(50.0, -50.0) .vertex(50.0, 50.0) .vertex(-50.0, 50.0);
pub fn build(self) -> Result<Polygon, ()>
[src]
Finishes building the Polygon
with all
vertices that have been configured up to this point
Errors
This method will return an error if the number of configured
vertices is less than three, as the resulting Polygon
would not be two-dimensional.
Examples
use myelin_geometry::PolygonBuilder; let square = PolygonBuilder::default() .vertex(-50.0, -50.0) .vertex(50.0, -50.0) .vertex(50.0, 50.0) .vertex(-50.0, 50.0) .build() .unwrap();
Trait Implementations
impl Debug for PolygonBuilder
[src]
impl Default for PolygonBuilder
[src]
pub fn default() -> PolygonBuilder
[src]
Auto Trait Implementations
impl RefUnwindSafe for PolygonBuilder
[src]
impl Send for PolygonBuilder
[src]
impl Sync for PolygonBuilder
[src]
impl Unpin for PolygonBuilder
[src]
impl UnwindSafe for PolygonBuilder
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,