eureka_mmanager/files_dirs/messages/pull/chapter/
chapter_data_pull.rs1use actix::prelude::*;
2use mangadex_api_schema_rust::v5::ChapterObject;
3use uuid::Uuid;
4
5use crate::{data_pulls::Pull, DirsOptions, ManagerCoreResult};
6
7#[derive(Debug, Clone, Hash, Default)]
8pub struct ChapterDataPullMessage(pub Uuid);
9
10impl From<Uuid> for ChapterDataPullMessage {
11 fn from(value: Uuid) -> Self {
12 Self(value)
13 }
14}
15
16impl From<ChapterDataPullMessage> for Uuid {
17 fn from(value: ChapterDataPullMessage) -> Self {
18 value.0
19 }
20}
21
22impl Message for ChapterDataPullMessage {
23 type Result = ManagerCoreResult<ChapterObject>;
24}
25
26impl Handler<ChapterDataPullMessage> for DirsOptions {
27 type Result = <ChapterDataPullMessage as Message>::Result;
28 fn handle(&mut self, msg: ChapterDataPullMessage, _ctx: &mut Self::Context) -> Self::Result {
30 Pull::<ChapterObject, Uuid>::pull(&**self, msg.into())
31 .map_err(|e: api_core::Error| e.into())
32 }
33}