Struct dyer::component::task::Task[][src]

pub struct Task<T> where
    T: Serialize + for<'a> Deserialize<'a> + Debug + Clone
{ pub uri: String, pub method: String, pub headers: HashMap<String, String>, pub body: Option<HashMap<String, String>>, pub able: f64, pub trys: u8, pub parser: String, pub targs: Option<T>, }
Expand description

Task, as it means, a scheduled job to be done, contains most infomation of Request. For the purposes of extensive compatibility, A generic parameter T is required in dealing with it.

Fields

uri: Stringmethod: Stringheaders: HashMap<String, String>
Expand description

additional headers if necessary

body: Option<HashMap<String, String>>
Expand description

Formdata or other request parameter stored here

able: f64
Expand description

checkpoint in seconds by which this Task is allowed to be executed

trys: u8
Expand description

times that this Task has failed, by default, the threshold is 2, customize it in ArgApp

parser: String
Expand description

the index to get the parser parsing the Response when it’s done

targs: Option<T>
Expand description

additional arguments for extensive application

Implementations

impl<T> Task<T> where
    T: Serialize + for<'a> Deserialize<'a> + Debug + Clone
[src]

pub fn new() -> Self[src]

create an instance

pub fn stored(path: &str, task: &mut Arc<Mutex<Vec<Task<T>>>>)[src]

store unfinished or extra Tasks,

pub fn load(path: &str) -> Vec<Task<T>>[src]

load unfinished or extra Tasks

Trait Implementations

impl<T: Clone> Clone for Task<T> where
    T: Serialize + for<'a> Deserialize<'a> + Debug + Clone
[src]

fn clone(&self) -> Task<T>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Debug> Debug for Task<T> where
    T: Serialize + for<'a> Deserialize<'a> + Debug + Clone
[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'de, T> Deserialize<'de> for Task<T> where
    T: Serialize + for<'a> Deserialize<'a> + Debug + Clone,
    T: Serialize + for<'a> Deserialize<'a> + Debug + Clone
[src]

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl<T> Serialize for Task<T> where
    T: Serialize + for<'a> Deserialize<'a> + Debug + Clone,
    T: Serialize + for<'a> Deserialize<'a> + Debug + Clone
[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

impl<T> RefUnwindSafe for Task<T> where
    T: RefUnwindSafe

impl<T> Send for Task<T> where
    T: Send

impl<T> Sync for Task<T> where
    T: Sync

impl<T> Unpin for Task<T> where
    T: Unpin

impl<T> UnwindSafe for Task<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]