pub struct ThinArrow<Coord, Size: SizeDesc> { /* private fields */ }

Implementations§

source§

impl<Coord> ThinArrow<Coord, i32>

source

pub fn new(nock: Coord, tip: Coord, style: impl Into<ShapeStyle>) -> Self

Examples found in repository?
examples/thin-arrows.rs (line 31)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
fn main() -> Result<(), DrawingAreaErrorKind<<BitMapBackend<'static> as DrawingBackend>::ErrorType>>
{
    let target = Path::new("example.png");
    let graph_root = BitMapBackend::new(target, (256, 256)).into_drawing_area();
    graph_root.fill(&WHITE)?;
    let mut chart = ChartBuilder::on(&graph_root)
        .margin(8)
        .x_label_area_size(24)
        .y_label_area_size(24)
        .build_cartesian_2d(0f64..1f64, 0f64..1f64)?;

    chart.configure_mesh().draw()?;

    let x_count = 16;
    let y_count = 16;
    let arrow_size = 0.05;
    chart.draw_series(
        (0..=x_count)
            .flat_map(|xi| (0..=y_count).map(move |yi| (xi, yi)))
            .map(|(xi, yi)| {
                let x = xi as f64 / x_count as f64;
                let y = yi as f64 / y_count as f64;
                let dx = arrow_size * f64::cos(y * TAU);
                let dy = arrow_size * f64::cos(x * TAU);
                ThinArrow::new((x, y), (x + dx, y + dy), &RED)
            }),
    )?;

    graph_root.present()?;

    Ok(())
}
source§

impl<Coord, Size: SizeDesc> ThinArrow<Coord, Size>

source

pub fn new_detail(
    nock: Coord,
    tip: Coord,
    head: Size,
    width: Size,
    style: impl Into<ShapeStyle>
) -> Self

source

pub fn head(self, head: Size) -> Self

source

pub fn width(self, width: Size) -> Self

Trait Implementations§

source§

impl<Coord: Clone, Size: Clone + SizeDesc> Clone for ThinArrow<Coord, Size>

source§

fn clone(&self) -> ThinArrow<Coord, Size>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<DB: DrawingBackend, Coord, Size: SizeDesc> Drawable<DB, BackendCoordOnly> for ThinArrow<Coord, Size>

source§

fn draw<I: Iterator<Item = BackendCoord>>(
    &self,
    pos: I,
    backend: &mut DB,
    parent_dim: (u32, u32)
) -> Result<(), DrawingErrorKind<DB::ErrorType>>

Actually draws the element. The key points is already translated into the image coordinate and can be used by DC directly
source§

impl<'a, Coord: 'a, Size: SizeDesc> PointCollection<'a, Coord, BackendCoordOnly> for &'a ThinArrow<Coord, Size>

§

type Point = &'a Coord

The item in point iterator
§

type IntoIter = &'a [Coord]

The point iterator
source§

fn point_iter(self) -> Self::IntoIter

framework to do the coordinate mapping

Auto Trait Implementations§

§

impl<Coord, Size> RefUnwindSafe for ThinArrow<Coord, Size>where
    Coord: RefUnwindSafe,
    Size: RefUnwindSafe,

§

impl<Coord, Size> Send for ThinArrow<Coord, Size>where
    Coord: Send,
    Size: Send,

§

impl<Coord, Size> Sync for ThinArrow<Coord, Size>where
    Coord: Sync,
    Size: Sync,

§

impl<Coord, Size> Unpin for ThinArrow<Coord, Size>where
    Coord: Unpin,
    Size: Unpin,

§

impl<Coord, Size> UnwindSafe for ThinArrow<Coord, Size>where
    Coord: UnwindSafe,
    Size: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<'b, T, DB, Coord> IntoDynElement<'b, DB, Coord> for Twhere
    T: Drawable<DB, BackendCoordOnly> + 'b,
    &'a T: for<'a> PointCollection<'a, Coord, BackendCoordOnly>,
    Coord: Clone,
    DB: DrawingBackend,

source§

fn into_dyn(self) -> DynElement<'b, DB, Coord>

Make the conversion
source§

impl<T> ToOwned for Twhere
    T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.