[−][src]Struct polys::Reg
Struct that represents a regular polygon.
Implementations
impl Reg
[src]
Trait Implementations
impl Debug for Reg
[src]
impl Polygon for Reg
[src]
fn area(&self) -> f64
[src]
Gets the area of the Reg.
Examples
let reg = polys::Reg::new(3, 5); let area = reg.area(); assert_eq!(area, 15.484296605300704);
This can also be seen by comparing the Rect square and Reg implementations.
let square = polys::Rect::square(7).area(); let reg = polys::Reg::new(7, 4) .area(); assert_eq!(square, reg);
fn peri(&self) -> f64
[src]
Gets the perimeter of the Reg.
Examples
This works on a regular polygon where it has 5 of more sides.
let reg = polys::Reg::new(3, 5); let peri = reg.peri(); assert_eq!(peri, 15);
This can also be seen by comparing the Rect square and Reg implementations.
let square = polys::Rect::square(7).peri(); let reg = polys::Reg::new(7, 4) .peri(); assert_eq!(square, reg);
Auto Trait Implementations
impl RefUnwindSafe for Reg
impl Send for Reg
impl Sync for Reg
impl Unpin for Reg
impl UnwindSafe for Reg
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,
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.
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>,