Struct dot4ch::board::Board[][src]

pub struct Board {
    pub threads: HashMap<u32, Thread>,
    pub board: String,
}
Expand description

Holds an abstraction over HashMap<u32, Thread> which can be used to any post with a Post number.

Fields

threads: HashMap<u32, Thread>board: String

Implementations

impl Board[src]

pub async fn build(
    client: &mut Arc<Mutex<Client>>,
    board: &str
) -> Result<Self, Box<dyn Error>>
[src]

Returns an entire board containing all of its posts at one point.

This is an expensive one time operation.

Time

A typical board of ~150 threads takes 5+ minutes to cache.

It is advised to build this only once due to its long wait times caused by API cooldowns.

pub fn get(self, k: u32) -> Option<Thread>[src]

Returns a specific Thread from the Board cache.

pub fn insert(&mut self, id: u32, thread: Thread) -> Option<Thread>[src]

Inserts a new thread into a cache.

If a thread already exists, it updates the thread while retaining the post number and returns the old thread.

pub fn board(&self) -> &str[src]

Returns the board of the cache

Trait Implementations

impl Debug for Board[src]

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

Formats the value using the given formatter. Read more

impl Update for Board[src]

fn update<'life0, 'async_trait>(
    self,
    client: &'life0 mut Arc<Mutex<Client>>
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Returns an updated board.

It is recommended to call this infrequently due to API calls having cooldowns.

Uses If-Modified-Since header internally.

type Output = Board

The type of the output

Auto Trait Implementations

impl RefUnwindSafe for Board

impl Send for Board

impl Sync for Board

impl Unpin for Board

impl UnwindSafe for Board

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, U> Into<U> for T where
    U: From<T>, 
[src]

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

Performs the conversion.

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.