[][src]Struct polys::circle::Circle

pub struct Circle {
    pub radius: f64,
}

Struct that represents a circle.

Fields

radius: f64

Implementations

impl Circle[src]

pub fn new(r: f64) -> Circle[src]

Returns a new Circle from given radius r.

Examples

let circle = polys::Circle::new(5.0);

Trait Implementations

impl Debug for Circle[src]

impl Polygon for Circle[src]

fn area(&self) -> f64[src]

Gets the area of the Circle from its radius.

Examples

use crate::polys::Polygon;
let circle = polys::Circle::new(5.0);
let area = circle.area();
assert_eq!(area, (std::f64::consts::PI * 25f64) as f64);

fn peri(&self) -> f64[src]

Gets the circumferance of the Circle from its radius.

Examples

use crate::polys::Polygon;
use core::f64::consts::PI;

let circle = polys::Circle::new(5.0);
let peri = circle.peri();
assert_eq!(peri, 10f64*PI);

fn angles(&self) -> Vec<f64>[src]

Returns an empty vector.

Examples

use crate::polys::Polygon;
let circle = polys::Circle::new(5.0);
let angles = circle.angles();
assert!(angles.is_empty());

Auto Trait Implementations

impl RefUnwindSafe for Circle

impl Send for Circle

impl Sync for Circle

impl Unpin for Circle

impl UnwindSafe for Circle

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.