From aad33fee01abe817d82c094f83ffd44ca36c8456 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Sat, 14 Sep 2024 21:11:51 -0400 Subject: feat: reverse sort posts by modify datetime --- src/views/posts.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/views') diff --git a/src/views/posts.rs b/src/views/posts.rs index 2ce69f8..82b5996 100644 --- a/src/views/posts.rs +++ b/src/views/posts.rs @@ -10,8 +10,9 @@ pub struct PostsView { impl PostsView

{ pub fn with_posts(posts: impl IntoIterator) -> Self { - Self { - posts: posts.into_iter().collect(), - } + let mut posts: Vec

= posts.into_iter().collect(); + posts.sort(); + posts.reverse(); + Self { posts } } } -- cgit v1.2.3