Struct napchart::ChartLane [−][src]
pub struct ChartLane { pub locked: bool, // some fields omitted }
Expand description
A single lane of a napchart
Fields
locked: bool
Whether the lane is locked on napchart.com. Has no effect in rust.
Implementations
Clear all elements from the lane.
let mut chart = Napchart::default(); let mut lane = chart.add_lane(); lane.add_element(0, 60).unwrap(); lane.add_element(60, 120).unwrap(); lane.add_element(120, 180).unwrap(); assert!(!lane.is_empty()); lane.clear(); assert!(lane.is_empty());
True if the lane has no elements.
let mut chart = Napchart::default(); let mut lane = chart.add_lane(); assert!(lane.is_empty()); lane.add_element(0, 60).unwrap(); assert!(!lane.is_empty());
The number of elements in the lane.
let mut chart = Napchart::default(); let mut lane = chart.add_lane(); assert_eq!(lane.elems_len(), 0); lane.add_element(0, 60).unwrap(); lane.add_element(60, 120).unwrap(); lane.add_element(120, 180).unwrap(); assert_eq!(lane.elems_len(), 3);
Add a new element to the lane. Start and end must both be between [0 and 1440). Error if the new element would overlap with the existing elements.
let mut chart = Napchart::default(); let mut lane = chart.add_lane(); assert!(lane.add_element(0, 30).is_ok()); assert!(lane.add_element(15, 45).is_err()); assert!(lane.add_element(30, 60).is_ok()); assert_eq!(lane.elems_len(), 2);
Get an iterator over the elements in the lane.
let mut chart = Napchart::default(); let mut lane = chart.add_lane(); lane.add_element(0, 60).unwrap(); lane.add_element(60, 120).unwrap(); lane.add_element(120, 180).unwrap(); let mut iter = lane.elems_iter(); assert_eq!(iter.next().unwrap().get_position(), (0, 60)); assert_eq!(iter.next().unwrap().get_position(), (60, 120)); assert_eq!(iter.next().unwrap().get_position(), (120, 180));
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ChartLane
impl UnwindSafe for ChartLane
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more