Skip to main content

Arrow

Struct Arrow 

Source
pub struct Arrow {
    pub angle: f64,
    pub length: f64,
    pub ends: ArrowEnds,
    pub kind: ArrowType,
    pub position: f64,
    pub length_per_linewidth: f64,
}
Expand description

Describes an arrowhead to draw at the end(s) of a line-like geom, following R grid’s arrow(). position and length_per_linewidth are ggplot-rs extensions, not part of grid’s API.

Fields§

§angle: f64

Half-angle of the arrowhead, in degrees. The full opening angle (between the two wings) is 2 * angle.

§length: f64

Wing length in pixels.

§ends: ArrowEnds

Which end(s) of the path get a head. Default ArrowEnds::Last.

§kind: ArrowType

Open (stroked wings) or closed (filled triangle). Default ArrowType::Open.

§position: f64

Where along the path’s arc length the head sits, as a fraction in [0, 1] measured from the path’s start (1.0, the default, is the very end for ArrowEnds::Last, the very start for ArrowEnds::First). Extension: not part of grid’s arrow().

§length_per_linewidth: f64

When set above 0, the effective wing length is max(length, length_per_linewidth * linewidth), so arrowheads scale up with a thick line. Extension: not part of grid’s arrow().

Implementations§

Source§

impl Arrow

Source

pub fn angle(self, degrees: f64) -> Self

Half-angle of the wings, in degrees. Default 30.0.

Source

pub fn length(self, px: f64) -> Self

Wing length in pixels. Default 18.0.

Source

pub fn ends(self, ends: ArrowEnds) -> Self

Which end(s) of the path get a head.

Source

pub fn kind(self, kind: ArrowType) -> Self

Open (stroked wings) or closed (filled triangle).

Source

pub fn closed(self) -> Self

Shorthand for .kind(ArrowType::Closed).

Source

pub fn open(self) -> Self

Shorthand for .kind(ArrowType::Open).

Source

pub fn position(self, fraction: f64) -> Self

Where along the path’s arc length the head sits — see the position field doc.

Source

pub fn length_per_linewidth(self, k: f64) -> Self

Scale the effective wing length with the stroke width — see the length_per_linewidth field doc.

Trait Implementations§

Source§

impl Clone for Arrow

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Arrow

Source§

impl Debug for Arrow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Arrow

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Arrow

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Arrow

Auto Trait Implementations§

§

impl Freeze for Arrow

§

impl RefUnwindSafe for Arrow

§

impl Send for Arrow

§

impl Sync for Arrow

§

impl Unpin for Arrow

§

impl UnsafeUnpin for Arrow

§

impl UnwindSafe for Arrow

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V