pub struct Response {Show 19 fields
pub id: Uuid,
pub platform: String,
pub account: String,
pub module: String,
pub status_code: u16,
pub cookies: Cookies,
pub content: Vec<u8>,
pub storage_path: Option<String>,
pub headers: Vec<(String, String)>,
pub task_retry_times: usize,
pub metadata: MetaData,
pub download_middleware: Vec<String>,
pub data_middleware: Vec<String>,
pub task_finished: bool,
pub context: ExecutionMark,
pub run_id: Uuid,
pub prefix_request: Uuid,
pub request_hash: Option<String>,
pub priority: Priority,
}Fields§
§id: Uuid§platform: String§account: String§module: String§status_code: u16§content: Vec<u8>§storage_path: Option<String>§headers: Vec<(String, String)>§task_retry_times: usize§metadata: MetaData§download_middleware: Vec<String>§data_middleware: Vec<String>§task_finished: bool§context: ExecutionMark§run_id: Uuid§prefix_request: Uuid§request_hash: Option<String>§priority: PriorityImplementations§
Source§impl Response
impl Response
Sourcepub fn text(&self) -> Result<&str>
pub fn text(&self) -> Result<&str>
Decodes the response body as a UTF-8 string (strict; invalid bytes return an error).
Sourcepub fn text_lossy(&self) -> Cow<'_, str>
pub fn text_lossy(&self) -> Cow<'_, str>
Decodes the response body as UTF-8 (invalid bytes are replaced with U+FFFD).
Sourcepub fn json<T: DeserializeOwned>(&self) -> Result<T>
pub fn json<T: DeserializeOwned>(&self) -> Result<T>
Deserializes the response body as JSON.
pub fn task_id(&self) -> String
pub fn module_id(&self) -> String
Sourcepub fn task_runtime_id(&self) -> String
pub fn task_runtime_id(&self) -> String
Run-scoped task identifier for error tracking.
Sourcepub fn module_runtime_id(&self) -> String
pub fn module_runtime_id(&self) -> String
Run-scoped module identifier for error tracking.
pub fn get_meta<T>(&self, key: &str) -> Option<T>where
T: for<'de> Deserialize<'de>,
pub fn get_login_config<T>(&self, key: &str) -> Option<T>where
T: for<'de> Deserialize<'de>,
pub fn get_module_config<T>(&self, key: &str) -> Option<T>where
T: for<'de> Deserialize<'de>,
pub fn get_task_config<T>(&self, key: &str) -> Option<T>where
T: for<'de> Deserialize<'de>,
pub fn get_context(&self) -> &ExecutionMark
pub fn with_context(self, ctx: ExecutionMark) -> Self
Trait Implementations§
Source§impl CacheAble for Response
impl CacheAble for Response
fn field() -> impl AsRef<str>
fn serialized_size_hint(&self) -> Option<usize>
fn clone_for_serialize(&self) -> Option<Self>
fn send<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn send_persistent<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_persistent<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store this value in the cache with no TTL (persistent until explicitly deleted).
fn send_with_ttl<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_nx<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<bool, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn sync<'life0, 'life1, 'async_trait>(
id: &'life0 str,
sync: &'life1 CacheService,
) -> Pin<Box<dyn Future<Output = Result<Option<Self>, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
id: &'life0 str,
sync: &'life1 CacheService,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn scan<'life0, 'life1, 'async_trait>(
pattern_suffix: &'life0 str,
sync: &'life1 CacheService,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cache_id(id: &str, cache: &CacheService) -> String
Source§impl<'de> Deserialize<'de> for Response
impl<'de> Deserialize<'de> for Response
Source§fn 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
Source§impl EventProcessorTrait<Response, (Response, Arc<Module>, Arc<ModuleConfig>, Option<LoginInfo>)> for ResponseModuleProcessor
impl EventProcessorTrait<Response, (Response, Arc<Module>, Arc<ModuleConfig>, Option<LoginInfo>)> for ResponseModuleProcessor
fn pre_status(&self, input: &Response) -> Option<EventEnvelope>
fn finish_status( &self, input: &Response, _output: &(Response, Arc<Module>, Arc<ModuleConfig>, Option<LoginInfo>), ) -> Option<EventEnvelope>
fn working_status(&self, input: &Response) -> Option<EventEnvelope>
fn error_status(&self, input: &Response, err: &Error) -> Option<EventEnvelope>
fn retry_status( &self, input: &Response, retry_policy: &RetryPolicy, ) -> Option<EventEnvelope>
Source§impl From<&Response> for TaskParserEvent
impl From<&Response> for TaskParserEvent
Source§impl From<&Response> for TaskErrorEvent
impl From<&Response> for TaskErrorEvent
Source§impl From<&Response> for ParserEvent
impl From<&Response> for ParserEvent
Source§impl From<&Response> for ResponseEvent
impl From<&Response> for ResponseEvent
Source§impl From<&Response> for ModuleGenerateEvent
impl From<&Response> for ModuleGenerateEvent
Source§impl Identifiable for Response
impl Identifiable for Response
Source§impl Offloadable for Response
impl Offloadable for Response
fn should_offload(&self, threshold: usize) -> bool
fn offload<'life0, 'life1, 'async_trait>(
&'life0 mut self,
storage: &'life1 Arc<dyn BlobStorage>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn reload<'life0, 'life1, 'async_trait>(
&'life0 mut self,
storage: &'life1 Arc<dyn BlobStorage>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl Prioritizable for Response
impl Prioritizable for Response
fn get_priority(&self) -> Priority
Source§impl ProcessorTrait<Response, (Response, Arc<Module>, Arc<ModuleConfig>, Option<LoginInfo>)> for ResponseModuleProcessor
impl ProcessorTrait<Response, (Response, Arc<Module>, Arc<ModuleConfig>, Option<LoginInfo>)> for ResponseModuleProcessor
Source§fn process<'life0, 'async_trait>(
&'life0 self,
input: Response,
context: ProcessorContext,
) -> Pin<Box<dyn Future<Output = ProcessorResult<(Response, Arc<Module>, Arc<ModuleConfig>, Option<LoginInfo>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process<'life0, 'async_trait>(
&'life0 self,
input: Response,
context: ProcessorContext,
) -> Pin<Box<dyn Future<Output = ProcessorResult<(Response, Arc<Module>, Arc<ModuleConfig>, Option<LoginInfo>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Processes input data.
Source§fn pre_process<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
input: &'life1 Response,
_context: &'life2 ProcessorContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn pre_process<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
input: &'life1 Response,
_context: &'life2 ProcessorContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Optional pre-processing hook.
Source§fn post_process<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_input: &'life1 Input,
_output: &'life2 Output,
_context: &'life3 ProcessorContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn post_process<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_input: &'life1 Input,
_output: &'life2 Output,
_context: &'life3 ProcessorContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Optional post-processing hook.
Source§fn handle_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_input: &'life1 Input,
_error: Error,
_context: &'life2 ProcessorContext,
) -> Pin<Box<dyn Future<Output = ProcessorResult<Output>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_input: &'life1 Input,
_error: Error,
_context: &'life2 ProcessorContext,
) -> Pin<Box<dyn Future<Output = ProcessorResult<Output>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Optional error handling hook.
Source§fn should_process<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_input: &'life1 Input,
_context: &'life2 ProcessorContext,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn should_process<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_input: &'life1 Input,
_context: &'life2 ProcessorContext,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Optional predicate to decide whether this input should be processed.
Auto Trait Implementations§
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl UnwindSafe for Response
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more