pub struct ThreadView {
pub roots: Vec<ThreadNode>,
/* private fields */
}Expand description
Represents a collection of threaded conversations.
Fields§
§roots: Vec<ThreadNode>Root posts (posts that are not replies to anything)
Implementations§
Source§impl ThreadView
impl ThreadView
Sourcepub fn sort_threads(&mut self)
pub fn sort_threads(&mut self)
Sort all threads and their replies chronologically.
pub fn thread_count(&self) -> usize
pub fn total_posts(&self) -> usize
pub fn flatten(&self) -> Vec<&Rc<RefCell<Post>>>
pub fn is_empty(&self) -> bool
pub fn update_poll_node(&self, post_node: &ThreadNode, poll: &mut Poll)
Sourcepub fn add_post(&mut self, post: Rc<RefCell<Post>>)
pub fn add_post(&mut self, post: Rc<RefCell<Post>>)
Add a new post to the thread tree.
If the post is a reply, it will be added to the appropriate parent node. If the parent doesn’t exist, a placeholder will be created. If it’s not a reply, it will be added as a new root thread.
After adding the post, latest activity times will be updated and threads will be re-sorted.
§Arguments
post- The new post to add to the thread tree
Trait Implementations§
Source§impl Default for ThreadView
impl Default for ThreadView
Source§impl Display for ThreadView
impl Display for ThreadView
Source§impl FeedView for ThreadView
impl FeedView for ThreadView
Source§fn apply_filter(&mut self, filter_fn: Box<dyn Fn(&Post) -> bool>)
fn apply_filter(&mut self, filter_fn: Box<dyn Fn(&Post) -> bool>)
Apply a filter closure to the posts in this view This keeps only branches of the thread tree where at least one post matches the filter.
Source§fn update_content(&mut self, feed: &Feed)
fn update_content(&mut self, feed: &Feed)
Update the view with new posts and profiles.
This is called by the parent Feed when the underlying data changes, and when the view is first added.
Auto Trait Implementations§
impl !RefUnwindSafe for ThreadView
impl !Send for ThreadView
impl !Sync for ThreadView
impl !UnwindSafe for ThreadView
impl Freeze for ThreadView
impl Unpin for ThreadView
impl UnsafeUnpin for ThreadView
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<T> ErasedDestructor for Twhere
T: 'static,
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.