Struct ibdl_core::queue::summary::SummaryFile
source · pub struct SummaryFile {
pub file_mode: SummaryType,
pub imageboard: ImageBoards,
pub name_mode: NameType,
pub tags: Vec<String>,
pub last_updated: DateTime<Utc>,
pub last_downloaded: u64,
pub posts: Vec<PostInfo>,
}
Expand description
The final summary file. It containes common information for the user to read and the necessary data to filter posts in certain occasions.
Fields
file_mode: SummaryType
imageboard: ImageBoards
name_mode: NameType
last_updated: DateTime<Utc>
last_downloaded: u64
posts: Vec<PostInfo>
Implementations
sourceimpl SummaryFile
impl SummaryFile
sourcepub fn new(
imageboard: ImageBoards,
tags: &[String],
posts: &[Post],
name_mode: NameType,
file_mode: SummaryType
) -> Self
pub fn new(
imageboard: ImageBoards,
tags: &[String],
posts: &[Post],
name_mode: NameType,
file_mode: SummaryType
) -> Self
Create a SummaryFile from the supplied information about all downloaded posts.
sourcepub fn write_zip_summary(
&self,
zip: &mut ZipWriter<File>
) -> Result<(), QueueError>
pub fn write_zip_summary(
&self,
zip: &mut ZipWriter<File>
) -> Result<(), QueueError>
Writes this struct as a summary file inside a supplied zip file.
sourcepub async fn write_summary(&self, path: &Path) -> Result<(), QueueError>
pub async fn write_summary(&self, path: &Path) -> Result<(), QueueError>
Writes this struct as a summary file in the given Path.
sourcepub async fn read_summary(
path: &Path,
summary_type: SummaryType
) -> Result<Self, QueueError>
pub async fn read_summary(
path: &Path,
summary_type: SummaryType
) -> Result<Self, QueueError>
Read the summary file from the supplied Path.
sourcepub fn from_bincode(slice: &[u8]) -> Result<Self, QueueError>
pub fn from_bincode(slice: &[u8]) -> Result<Self, QueueError>
Read the bincode summary and decode it into a SummaryFile
sourcepub fn from_json_slice(slice: &[u8]) -> Result<Self, QueueError>
pub fn from_json_slice(slice: &[u8]) -> Result<Self, QueueError>
Read the summary as a raw JSON slice from and decode it into a SummaryFile
sourcepub fn from_json_str(text: &str) -> Result<Self, QueueError>
pub fn from_json_str(text: &str) -> Result<Self, QueueError>
Read the summary as a raw JSON string and decode it into a SummaryFile
pub async fn read_zip_summary(
path: &Path,
summary_type: SummaryType
) -> Result<Self, QueueError>
pub fn to_json(&self) -> Result<String, QueueError>
pub fn to_bincode(&self) -> Result<Vec<u8>, QueueError>
Trait Implementations
sourceimpl Debug for SummaryFile
impl Debug for SummaryFile
sourceimpl<'de> Deserialize<'de> for SummaryFile
impl<'de> Deserialize<'de> for SummaryFile
sourcefn 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
sourceimpl Serialize for SummaryFile
impl Serialize for SummaryFile
Auto Trait Implementations
impl RefUnwindSafe for SummaryFile
impl Send for SummaryFile
impl Sync for SummaryFile
impl Unpin for SummaryFile
impl UnwindSafe for SummaryFile
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more