Struct Tier

Source
pub struct Tier { /* private fields */ }
Expand description

Represents an interval tier in a TextGrid.

Implementations§

Source§

impl Tier

Source

pub fn new(name: String, xmin: f64, xmax: f64, intervals: Vec<Interval>) -> Tier

Source§

impl Tier

Source

pub fn name(&self) -> &String

Source

pub fn xmin(&self) -> &f64

Source

pub fn xmax(&self) -> &f64

Source

pub fn intervals(&self) -> &Vec<Interval>

Source§

impl Tier

Source

pub fn intervals_mut(&mut self) -> &mut Vec<Interval>

Source§

impl Tier

Source

pub fn set_name(&mut self, val: String) -> &mut Self

Source§

impl Tier

Source

pub fn set_xmin<T: Into<Option<bool>>>(&mut self, xmin: f64, warn: T)

Sets the minimum x value for the interval tier.

§Arguments
  • xmin - The minimum x value to set.
  • warn - If true, displays a warning if the minimum point of any interval is greater than xmin.
Source

pub fn set_xmax<W: Into<Option<bool>>>(&mut self, xmax: f64, warn: W)

Sets the maximum x value for the interval tier.

§Arguments
  • xmax - The maximum x value to set.
  • warn - If true, displays a warning if the maximum point of any interval is less than xmax.
Source

pub fn get_size(&self) -> usize

Returns the number of intervals in the interval tier.

Source

pub fn push_interval<W: Into<Option<bool>>>( &mut self, interval: Interval, warn: W, )

Pushes an interval to the interval tier. Calls reorder() to ensure the intervals are sorted by their minimum x value after pushing the interval.

§Arguments
  • interval - The interval to push.
  • warn - If Some(true), displays a warning if the minimum point of the interval is less than the minimum x value of the interval tier.
Source

pub fn push_intervals<W: Into<Option<bool>> + Copy>( &mut self, intervals: Vec<Interval>, warn: W, )

Pushes multiple intervals to the interval tier vector. Calls reorder() afterwards to ensure the intervals are sorted by their minimum x value after pushing the intervals.

§Arguments
  • intervals - The intervals to push.
  • warn - If Some(true), displays a warning if the minimum point of any interval is less than the minimum x value of the interval tier.
Source

pub fn set_intervals<W: Into<Option<bool>>>( &mut self, intervals: Vec<Interval>, warn: W, )

Sets the intervals of the interval tier.

§Arguments
  • intervals - The intervals to set.
  • warn - If Some(true), displays a warning if any interval’s minimum point is less than the minimum x value of the interval tier or if any interval’s maximum point is greater than the maximum x value of the interval tier.
Source

pub fn check_overlaps(&self) -> Option<Vec<(u64, u64)>>

Checks for overlaps in the interval tier. Calls reorder to ensure the intervals are sorted by their minimum x value before checking for overlaps.

§Returns

A vector of pairs of the overlapping intervals’ indices or None if there are no overlaps.

Source

pub fn fix_boundaries<P: Into<Option<bool>> + Copy>(&mut self, prefer_first: P)

Fixes gaps/overlaps in the interval tier. Calls reorder to ensure the intervals are sorted by their minimum x value before fixing gaps/overlaps.

§Arguments
  • prefer_first - true by default. If true, prefers the first interval in the case of a gap. If false, prefers the second interval in the case of a gap.
§Panics

If the amount of intervals exceeds isize::MAX.

Source

pub fn fill_gaps(&mut self, text: &str)

Fills gaps within an IntervalTier with the specified text, ensuring no time period is left empty.

§Arguments
  • text - The text to fill the gaps with.
§Panics

If the amount of intervals exceeds isize::MAX.

Trait Implementations§

Source§

impl Clone for Tier

Source§

fn clone(&self) -> Tier

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Tier

Source§

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

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

impl Default for Tier

Source§

fn default() -> Tier

Returns the “default value” for a type. Read more
Source§

impl Display for Tier

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Tier

§

impl RefUnwindSafe for Tier

§

impl Send for Tier

§

impl Sync for Tier

§

impl Unpin for Tier

§

impl UnwindSafe for Tier

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, 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.