pub struct Stream {
pub id: String,
pub stream_type: StreamType,
pub label: String,
pub content: Vec<String>,
pub choices: Option<Vec<Choice>>,
pub source: Option<StreamSource>,
pub content_hash: u64,
pub last_updated: SystemTime,
pub created_at: SystemTime,
}Fields§
§id: String§stream_type: StreamType§label: String§content: Vec<String>§choices: Option<Vec<Choice>>§source: Option<StreamSource>§content_hash: u64§last_updated: SystemTime§created_at: SystemTimeImplementations§
Source§impl Stream
impl Stream
Sourcepub fn new(
id: String,
stream_type: StreamType,
label: String,
content: Vec<String>,
choices: Option<Vec<Choice>>,
source: Option<StreamSource>,
) -> Self
pub fn new( id: String, stream_type: StreamType, label: String, content: Vec<String>, choices: Option<Vec<Choice>>, source: Option<StreamSource>, ) -> Self
Create a new stream with proper change detection initialization
Sourcepub fn update_content_hash(&mut self)
pub fn update_content_hash(&mut self)
Update the content hash for change detection
Sourcepub fn has_content_changed(&self) -> bool
pub fn has_content_changed(&self) -> bool
Check if content has changed since last hash update
Sourcepub fn update_content(&mut self, new_content: Vec<String>)
pub fn update_content(&mut self, new_content: Vec<String>)
Update content and automatically refresh change detection
Sourcepub fn update_choices(&mut self, new_choices: Option<Vec<Choice>>)
pub fn update_choices(&mut self, new_choices: Option<Vec<Choice>>)
Update choices and automatically refresh change detection
Sourcepub fn time_since_last_update(&self) -> Result<Duration, SystemTimeError>
pub fn time_since_last_update(&self) -> Result<Duration, SystemTimeError>
Get time since last update for staleness detection
Sourcepub fn is_closeable(&self) -> bool
pub fn is_closeable(&self) -> bool
F0219: Check if stream can be closed (has close button)
Trait Implementations§
Source§impl ChoicesStreamTrait for Stream
impl ChoicesStreamTrait for Stream
fn get_choices(&self) -> &Vec<Choice>
fn get_choices_mut(&mut self) -> &mut Vec<Choice>
fn set_choices(&mut self, choices: Vec<Choice>)
Source§impl ContentStreamTrait for Stream
impl ContentStreamTrait for Stream
fn get_content_lines(&self) -> &Vec<String>
fn set_content_lines(&mut self, content: Vec<String>)
Source§impl<'de> Deserialize<'de> for Stream
impl<'de> Deserialize<'de> for Stream
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 Eq for Stream
impl StructuralPartialEq for Stream
Auto Trait Implementations§
impl Forget for Stream
impl Freeze for Stream
impl Move for Stream
impl RefUnwindSafe for Stream
impl Send for Stream
impl Sync for Stream
impl Unpin for Stream
impl UnsafeUnpin for Stream
impl UnwindSafe for Stream
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.