pub struct OwnedTextDocument {
pub id: String,
pub text: String,
pub language: Option<String>,
pub timestamp: Option<Timestamp>,
}Expand description
Owned text document for storage, serialization, and cross-thread workflows.
Fields§
§id: StringStable caller-supplied document id.
text: StringUTF-8 document body.
language: Option<String>Optional BCP-47-style language hint such as en.
timestamp: Option<Timestamp>Optional media timestamp when this document came from a timed segment.
Implementations§
Source§impl OwnedTextDocument
impl OwnedTextDocument
Sourcepub fn from_segment_id(
id: impl Into<String>,
segment: &OwnedTextSegment,
) -> Self
pub fn from_segment_id( id: impl Into<String>, segment: &OwnedTextSegment, ) -> Self
Builds this value from segment identifier.
Sourcepub fn from_stream_segment(stream_id: &str, segment: &TextSegment<'_>) -> Self
pub fn from_stream_segment(stream_id: &str, segment: &TextSegment<'_>) -> Self
Builds this value from stream segment.
Sourcepub fn from_owned_stream_segment(
stream_id: &str,
segment: &OwnedTextSegment,
) -> Self
pub fn from_owned_stream_segment( stream_id: &str, segment: &OwnedTextSegment, ) -> Self
Builds this value from owned stream segment.
Sourcepub fn from_segment(
stream_id: impl Into<String>,
segment: &OwnedTextSegment,
) -> Self
pub fn from_segment( stream_id: impl Into<String>, segment: &OwnedTextSegment, ) -> Self
Builds a document using the supplied stream_id directly as the id.
Prefer OwnedTextDocument::from_segment_id when the id has already
been chosen, or OwnedTextDocument::from_owned_stream_segment for the
canonical stream_id:segment_index id.
Sourcepub fn as_document(&self) -> TextDocument<'_>
pub fn as_document(&self) -> TextDocument<'_>
Borrows this value as a document.
Trait Implementations§
Source§impl Clone for OwnedTextDocument
impl Clone for OwnedTextDocument
Source§fn clone(&self) -> OwnedTextDocument
fn clone(&self) -> OwnedTextDocument
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OwnedTextDocument
impl Debug for OwnedTextDocument
impl Eq for OwnedTextDocument
Source§impl From<OwnedTextDocument> for TextDocumentContract
impl From<OwnedTextDocument> for TextDocumentContract
Source§fn from(value: OwnedTextDocument) -> Self
fn from(value: OwnedTextDocument) -> Self
Converts to this type from the input type.
Source§impl PartialEq for OwnedTextDocument
impl PartialEq for OwnedTextDocument
Source§fn eq(&self, other: &OwnedTextDocument) -> bool
fn eq(&self, other: &OwnedTextDocument) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for OwnedTextDocument
Auto Trait Implementations§
impl Freeze for OwnedTextDocument
impl RefUnwindSafe for OwnedTextDocument
impl Send for OwnedTextDocument
impl Sync for OwnedTextDocument
impl Unpin for OwnedTextDocument
impl UnsafeUnpin for OwnedTextDocument
impl UnwindSafe for OwnedTextDocument
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