Skip to main content

Shape

Enum Shape 

Source
pub enum Shape {
    Polyline {
        points: Vec<[f64; 2]>,
        stroke: String,
        width: f64,
        dash: bool,
    },
    Dashed {
        points: Vec<[f64; 2]>,
        stroke: String,
        width: f64,
        dash: f64,
        gap: f64,
    },
    Polygon {
        points: Vec<[f64; 2]>,
        fill: String,
        opacity: f64,
        stroke: Option<String>,
        dash: bool,
    },
    Circle {
        c: [f64; 2],
        r: f64,
        fill: String,
    },
    Symbol {
        at: [f64; 2],
        kind: String,
        size: f64,
        fill: String,
        stroke: String,
    },
    Text {
        at: [f64; 2],
        text: String,
        anchor: Anchor,
        size: f64,
        fill: String,
    },
}
Expand description

A primitive, in pixels. Colours are strings, written as attributes.

Variants§

§

Polyline

An open line.

Fields

§points: Vec<[f64; 2]>

Its points.

§stroke: String

Colour.

§width: f64

Width.

§dash: bool

Dashed.

§

Dashed

An open line drawn dashed, with the lengths it was asked: a dash and a gap in pixels (stroke-dasharray), butt caps so that a gap stays a gap.

Fields

§points: Vec<[f64; 2]>

Its points.

§stroke: String

Colour.

§width: f64

Width.

§dash: f64

The length of a dash.

§gap: f64

The gap between two dashes.

§

Polygon

A closed area.

Fields

§points: Vec<[f64; 2]>

Its points.

§fill: String

Fill colour; "none" for an outline.

§opacity: f64

Fill opacity.

§stroke: Option<String>

Outline colour, if any.

§dash: bool

Outline dashed.

§

Circle

A disc.

Fields

§c: [f64; 2]

Centre.

§r: f64

Radius.

§fill: String

Fill colour.

§

Symbol

A marker’s symbol, centred on at and size pixels across: written as paths, so nothing is loaded and nothing is stripped, and kept at its pixel size by the zoom script (data-zoom-fixed) like a well’s head.

Fields

§at: [f64; 2]

Its centre.

§kind: String

The shape, one of crate::markers::declared’s ids that is drawn.

§size: f64

Its extent, pixels.

§fill: String

Fill colour; "none" for an outline.

§stroke: String

Outline colour.

§

Text

A text.

Fields

§at: [f64; 2]

Where.

§text: String

What.

§anchor: Anchor

Alignment.

§size: f64

Font size, pixels.

§fill: String

Colour.

Trait Implementations§

Source§

impl Clone for Shape

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 Debug for Shape

Source§

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

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

impl PartialEq for Shape

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 Shape

Auto Trait Implementations§

§

impl Freeze for Shape

§

impl RefUnwindSafe for Shape

§

impl Send for Shape

§

impl Sync for Shape

§

impl Unpin for Shape

§

impl UnsafeUnpin for Shape

§

impl UnwindSafe for Shape

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more