Struct napchart::ChartLane [−][src]
A single lane of a napchart
Fields
locked: bool
Whether the lane is locked on napchart.com. Has no effect in rust.
Implementations
impl ChartLane
[src]
pub fn clear(&mut self)
[src]
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());
pub fn is_empty(&self) -> bool
[src]
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());
pub fn elems_len(&self) -> usize
[src]
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);
pub fn add_element(
&mut self,
start: u16,
end: u16
) -> Result<&mut ChartElement, ErrorKind>
[src]
&mut self,
start: u16,
end: u16
) -> Result<&mut ChartElement, ErrorKind>
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);
pub fn elems_iter(&self) -> Iter<'_, ChartElement>
[src]
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
impl Clone for ChartLane
[src]
impl Debug for ChartLane
[src]
impl Default for ChartLane
[src]
impl Eq for ChartLane
[src]
impl PartialEq<ChartLane> for ChartLane
[src]
impl StructuralEq for ChartLane
[src]
impl StructuralPartialEq for ChartLane
[src]
Auto Trait Implementations
impl RefUnwindSafe for ChartLane
impl Send for ChartLane
impl Sync for ChartLane
impl Unpin for ChartLane
impl UnwindSafe for ChartLane
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,