pub struct ThinArrow<Coord, Size: SizeDesc> { /* private fields */ }Implementations§
Source§impl<Coord> ThinArrow<Coord, i32>
impl<Coord> ThinArrow<Coord, i32>
Sourcepub fn new(nock: Coord, tip: Coord, style: impl Into<ShapeStyle>) -> Self
pub fn new(nock: Coord, tip: Coord, style: impl Into<ShapeStyle>) -> Self
Examples found in repository?
examples/thin-arrows.rs (line 31)
7fn main() -> Result<(), DrawingAreaErrorKind<<BitMapBackend<'static> as DrawingBackend>::ErrorType>>
8{
9 let target = Path::new("example.png");
10 let graph_root = BitMapBackend::new(target, (256, 256)).into_drawing_area();
11 graph_root.fill(&WHITE)?;
12 let mut chart = ChartBuilder::on(&graph_root)
13 .margin(8)
14 .x_label_area_size(24)
15 .y_label_area_size(24)
16 .build_cartesian_2d(0f64..1f64, 0f64..1f64)?;
17
18 chart.configure_mesh().draw()?;
19
20 let x_count = 16;
21 let y_count = 16;
22 let arrow_size = 0.05;
23 chart.draw_series(
24 (0..=x_count)
25 .flat_map(|xi| (0..=y_count).map(move |yi| (xi, yi)))
26 .map(|(xi, yi)| {
27 let x = xi as f64 / x_count as f64;
28 let y = yi as f64 / y_count as f64;
29 let dx = arrow_size * f64::cos(y * TAU);
30 let dy = arrow_size * f64::cos(x * TAU);
31 ThinArrow::new((x, y), (x + dx, y + dy), &RED)
32 }),
33 )?;
34
35 graph_root.present()?;
36
37 Ok(())
38}Trait Implementations§
Auto Trait Implementations§
impl<Coord, Size> Freeze for ThinArrow<Coord, Size>
impl<Coord, Size> RefUnwindSafe for ThinArrow<Coord, Size>where
Size: RefUnwindSafe,
Coord: RefUnwindSafe,
impl<Coord, Size> Send for ThinArrow<Coord, Size>
impl<Coord, Size> Sync for ThinArrow<Coord, Size>
impl<Coord, Size> Unpin for ThinArrow<Coord, Size>
impl<Coord, Size> UnwindSafe for ThinArrow<Coord, Size>where
Size: UnwindSafe,
Coord: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'b, T, DB, Coord> IntoDynElement<'b, DB, Coord> for Twhere
T: Drawable<DB> + 'b,
&'a T: for<'a> PointCollection<'a, Coord>,
Coord: Clone,
DB: DrawingBackend,
impl<'b, T, DB, Coord> IntoDynElement<'b, DB, Coord> for Twhere
T: Drawable<DB> + 'b,
&'a T: for<'a> PointCollection<'a, Coord>,
Coord: Clone,
DB: DrawingBackend,
Source§fn into_dyn(self) -> DynElement<'b, DB, Coord>
fn into_dyn(self) -> DynElement<'b, DB, Coord>
Make the conversion