Struct napchart::ChartElement[][src]

pub struct ChartElement {
    pub data: ElementData,
    // some fields omitted
}

A single element in a napchart.

Fields

data: ElementData

Additional metadata for the element.

Implementations

impl ChartElement[src]

pub fn get_position(&self) -> (u16, u16)[src]

Returns the position of the element as (start, end), where start and end are minutes past midnight.

let mut chart = Napchart::default();
let mut lane = chart.add_lane();
let elem = lane.add_element(0, 60).unwrap();
assert_eq!(elem.get_position(), (0, 60));

pub fn text<T: ToString>(&mut self, text: T) -> &mut Self[src]

&mut builder function to set the text of an element.

let mut chart = Napchart::default();
let mut lane = chart.add_lane();
let elem = lane.add_element(0, 60).unwrap().text("Hour One");
assert_eq!(elem.data.text, Some(String::from("Hour One")));

pub fn color(&mut self, color: ChartColor) -> &mut Self[src]

&mut builder function to set the color of an element.

let mut chart = Napchart::default();
let mut lane = chart.add_lane();
let elem = lane.add_element(0, 60).unwrap().color(ChartColor::Blue);
assert_eq!(elem.data.color, ChartColor::Blue);

Trait Implementations

impl Clone for ChartElement[src]

impl Debug for ChartElement[src]

impl Default for ChartElement[src]

impl Eq for ChartElement[src]

impl PartialEq<ChartElement> for ChartElement[src]

impl StructuralEq for ChartElement[src]

impl StructuralPartialEq for ChartElement[src]

Auto Trait Implementations

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<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

impl<T> Instrument for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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