use std::fmt;
use crate::render::Gazetta;
use super::Page;
#[derive(Copy, Clone, Debug)]
pub struct Paginate<'a> {
pub current: usize,
pub pages: &'a [&'a str],
}
pub struct Index<'a, G>
where
G: Gazetta + 'a,
G::SiteMeta: 'a,
G::PageMeta: 'a,
{
pub compact: bool,
pub entries: &'a [Page<'a, G>],
pub paginate: Option<Paginate<'a>>,
pub feed: Option<&'a str>,
}
impl<'a, G> Copy for Index<'a, G>
where
G: Gazetta + 'a,
G::PageMeta: 'a,
G::SiteMeta: 'a,
{
}
impl<'a, G> Clone for Index<'a, G>
where
G: Gazetta + 'a,
G::PageMeta: 'a,
G::SiteMeta: 'a,
{
fn clone(&self) -> Self {
*self
}
}
impl<'a, G> fmt::Debug for Index<'a, G>
where
G: Gazetta + 'a,
G::PageMeta: fmt::Debug + 'a,
G::SiteMeta: 'a,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Index")
.field("compact", &self.compact)
.field("entries", &self.entries)
.field("paginate", &self.paginate)
.field("feed", &self.feed)
.finish()
}
}