pub struct Segment {
pub element: Box<dyn Element>,
pub timing: Timing,
pub name: Option<String>,
}
Fields§
§element: Box<dyn Element>
The element this segment represents.
timing: Timing
The timing interval this segment spans.
name: Option<String>
An optional name. When being rendered, this segment’s Rng are seeded with a combined hash of this name as well as the segment’s parent seed.
Implementations§
Source§impl Segment
impl Segment
Sourcepub fn unnamed(self) -> Segment
pub fn unnamed(self) -> Segment
Removes the Segment
’s a name, if it has one, returning the resulting unnamed segment.
Sourcepub fn element_as<Element>(&self) -> Option<&Element>where
Element: Element,
pub fn element_as<Element>(&self) -> Option<&Element>where
Element: Element,
Gets the contained element if its type matches type Element
, otherwise, None
is
returned.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Segment
impl<'de> Deserialize<'de> for Segment
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Segment, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Segment, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Segment
impl Serialize for Segment
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl<'a, T> TryFrom<&'a Segment> for SegmentRef<'a, T>where
T: Element,
impl<'a, T> TryFrom<&'a Segment> for SegmentRef<'a, T>where
T: Element,
Source§type Error = ConversionError
type Error = ConversionError
The type returned in the event of a conversion error.
Source§fn try_from(
value: &'a Segment,
) -> Result<SegmentRef<'a, T>, <SegmentRef<'a, T> as TryFrom<&'a Segment>>::Error>
fn try_from( value: &'a Segment, ) -> Result<SegmentRef<'a, T>, <SegmentRef<'a, T> as TryFrom<&'a Segment>>::Error>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for Segment
impl !RefUnwindSafe for Segment
impl !Send for Segment
impl !Sync for Segment
impl Unpin for Segment
impl !UnwindSafe for Segment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, R> RangeOps<T> for Rwhere
T: PartialOrd,
R: RangeBounds<T>,
impl<T, R> RangeOps<T> for Rwhere
T: PartialOrd,
R: RangeBounds<T>,
Source§fn is_before(&self, other: &impl RangeBounds<T>) -> bool
fn is_before(&self, other: &impl RangeBounds<T>) -> bool
Checks if this interval ends before the start of another.
Source§fn is_after(&self, other: &impl RangeBounds<T>) -> bool
fn is_after(&self, other: &impl RangeBounds<T>) -> bool
Checks if this interval starts after the end of another.
Source§fn is_disjoint_from(&self, other: &impl RangeBounds<T>) -> bool
fn is_disjoint_from(&self, other: &impl RangeBounds<T>) -> bool
Checks if an interval has no overlap with another.
Source§fn intersects(&self, other: &impl RangeBounds<T>) -> bool
fn intersects(&self, other: &impl RangeBounds<T>) -> bool
Checks if this interval has some overlap with another.
Source§fn contains_range(&self, other: &impl RangeBounds<T>) -> bool
fn contains_range(&self, other: &impl RangeBounds<T>) -> bool
Checks if this interval contains another.
Source§fn is_contained_by(&self, other: &impl RangeBounds<T>) -> bool
fn is_contained_by(&self, other: &impl RangeBounds<T>) -> bool
Checks if this interval is contained by another.
Source§fn begins_within(&self, other: &impl RangeBounds<T>) -> bool
fn begins_within(&self, other: &impl RangeBounds<T>) -> bool
Checks if this interval starts within another.
Source§fn ends_within(&self, other: &impl RangeBounds<T>) -> bool
fn ends_within(&self, other: &impl RangeBounds<T>) -> bool
Checks if this interval ends within another.