[][src]Struct livesplit_core::Segment

pub struct Segment { /* fields omitted */ }

A Segment describes a point in a speedrun that is suitable for storing a split time. This stores the name of that segment, an icon, the split times of different comparisons, and a history of segment times.

Examples

use livesplit_core::{Segment, Time, TimeSpan};

let mut segment = Segment::new("Metro Kingdom");

let time = Time::new().with_real_time(Some(TimeSpan::from_seconds(234.0)));
segment.set_personal_best_split_time(time);

Methods

impl Segment[src]

pub fn new<S>(name: S) -> Self where
    S: Into<String>, 
[src]

Creates a new Segment with the name given.

pub fn name(&self) -> &str[src]

Accesses the name of the segment.

pub fn set_name<S>(&mut self, name: S) where
    S: AsRef<str>, 
[src]

Sets the name of the segment.

pub fn icon(&self) -> &Image[src]

Accesses the icon of the segment.

pub fn set_icon<D: Into<Image>>(&mut self, image: D)[src]

Sets the icon of the segment.

pub fn comparisons_mut(&mut self) -> &mut HashMap<String, Time>[src]

Grants mutable access to the comparison times stored in the Segment. This includes both the custom comparisons and the generated ones.

pub fn comparison_mut(&mut self, comparison: &str) -> &mut Time[src]

Grants mutable access to the specified comparison's time. If there's none for this comparison, a new one is inserted with an empty time.

pub fn comparison(&self, comparison: &str) -> Time[src]

Accesses the specified comparison's time. If there's none for this comparison, an empty time is being returned (but not stored in the segment).

pub fn comparison_timing_method(
    &self,
    comparison: &str,
    method: TimingMethod
) -> Option<TimeSpan>
[src]

Accesses the given timing method of the specified comparison. If either the TimeSpan is empty or the comparison has no stored time, None is returned.

pub fn personal_best_split_time(&self) -> Time[src]

Accesses the split time of the Personal Best for this segment. If it doesn't exist, an empty time is returned.

pub fn personal_best_split_time_mut(&mut self) -> &mut Time[src]

Grants mutable access to the split time of the Personal Best for this segment. If it doesn't exist an empty time is inserted.

pub fn set_personal_best_split_time(&mut self, time: Time)[src]

Sets the split time of the Personal Best to the time provided.

pub fn best_segment_time(&self) -> Time[src]

Accesses the Best Segment Time.

pub fn best_segment_time_mut(&mut self) -> &mut Time[src]

Grants mutable access to the Best Segment Time.

pub fn set_best_segment_time(&mut self, time: Time)[src]

Sets the Best Segment Time.

pub fn split_time(&self) -> Time[src]

Accesses the split time of the current attempt.

pub fn split_time_mut(&mut self) -> &mut Time[src]

Grants mutable access to the split time of the current attempt.

pub fn set_split_time(&mut self, time: Time)[src]

Sets the split time of the current attempt.

pub fn clear_split_time(&mut self)[src]

Clears the split time of the current attempt.

pub fn segment_history(&self) -> &SegmentHistory[src]

Accesses the Segment History of this segment.

pub fn segment_history_mut(&mut self) -> &mut SegmentHistory[src]

Grants mutable access to the Segment History of this segment.

Trait Implementations

impl Clone for Segment[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<Segment> for Segment[src]

impl Default for Segment[src]

impl Debug for Segment[src]

Auto Trait Implementations

impl Send for Segment

impl Sync for Segment

Blanket Implementations

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

impl<T> From<T> for 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<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

fn adapt_into(self) -> D[src]

Convert the source color to the destination color using the bradford method by default Read more

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.