Trait dot4ch::Update [−][src]
pub trait Update {
type Output;
#[must_use]
fn update<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + 'async_trait>>
where
Self: 'async_trait;
#[must_use]
fn refresh_time<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
#[must_use]
fn fetch_status<'async_trait>(
self,
response: Response
) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + 'async_trait>>
where
Self: 'async_trait;
#[must_use]
fn into_upper<'async_trait>(
self,
response: Response
) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + 'async_trait>>
where
Self: 'async_trait;
}Expand description
Update trait specifies if something can be updated or not.
By default, only Threads, Catalogs, and Boards can be updated.
Example
use async_trait::async_trait; use dot4ch::Update; type Result<T> = anyhow::Result<T>; type Client = std::sync::Arc<tokio::sync::Mutex<dot4ch::Client>>; struct Something { pub stuff: i32 } #[async_trait(?Send)] impl Update for Something { type Output = i32; async fn update(mut self) -> Result<Self::Output> { let out = self.stuff + 32; Ok(out) } }
Associated Types
Required methods
Returns the updated self type.
Refreshes the last time the thread was accessed.
Matches the Self ’s status code to see if it has been updated,
Implementors
Returns an updated board.
It is recommended to call this infrequently due to API calls having cooldowns.
Uses If-Modified-Since header internally.
This is an unimplemented function that WILL panic.
Do NOT call this function
Since the Board is a fancy hashmap all its threads individually,
it uses the update functions on each threads.
which DO implement this method.
Therefore, this does not need to be implemented.
This is an unimplemented function that WILL panic.
Do NOT call this function
Since the Board is a fancy hashmap all its threads individually,
it uses the update functions on each threads.
which DO implement this method.
Therefore, this does not need to be implemented.
This is an unimplemented function that WILL panic.
Do NOT call this function
Since the Board is a fancy hashmap all its threads individually,
it uses the update functions on each threads.
which DO implement this method.
Therefore, this does not need to be implemented.
type Output = SelfReturns the updated 4chan thread.
update() respects
4chan’s 10 seconds between each chan thread call.
Checks the status of a Response and generates a new thread if needed.
Converts the Response into a Thread
type Output = SelfReturns an updated catalog.
Refreshes the time in the Thread instance.
also handles the sleep of the thread update.
Errors
This function should probably not fail but can fail if
Updates the status of a Response and generates a new Catalog if needed.
Converts the Response into a Catalog
type Output = Self