pub struct Segment { /* private fields */ }Expand description
A single timed segment of transcript text.
Fields are private (JOE-1786). Construct with Segment::try_new (fail closed)
or deserialize then Segment::validate. Prefer accessors over free mutation.
Implementations§
Source§impl Segment
impl Segment
Sourcepub fn try_new(start: f64, end: f64, text: impl Into<String>) -> Result<Self>
pub fn try_new(start: f64, end: f64, text: impl Into<String>) -> Result<Self>
Construct a segment, rejecting NaN/Inf, negatives, and inverted ranges (JOE-1781).
Sourcepub fn from_parts_unchecked(
start: f64,
end: f64,
text: impl Into<String>,
) -> Self
pub fn from_parts_unchecked( start: f64, end: f64, text: impl Into<String>, ) -> Self
Construct without validation (trusted provider/postprocess paths and tests).
Prefer Segment::try_new for host-facing construction. Callers that
skip validation must treat the segment as untrusted until Segment::validate.
pub fn start(&self) -> f64
pub fn end(&self) -> f64
pub fn text(&self) -> &str
pub fn set_start(&mut self, start: f64)
pub fn set_end(&mut self, end: f64)
pub fn set_text(&mut self, text: impl Into<String>)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Segment
impl<'de> Deserialize<'de> for Segment
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Segment
Auto Trait Implementations§
impl Freeze for Segment
impl RefUnwindSafe for Segment
impl Send for Segment
impl Sync for Segment
impl Unpin for Segment
impl UnsafeUnpin 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more