Crate dot4ch[][src]

Expand description

dot4ch

dot4ch is a convenient wrapper library around 4chan’s API.

This library can fetch and update:

  • Posts
  • Threads
  • Catalog
  • Boards

While respecting 4chan’s:

Example: Getting an image from the OP of a thread

#[tokio::main]
async fn main() {
    use dot4ch::{Client, thread::Thread};
     
    // Making a client.
    let mut client = Client::new();
     
    // Building a board.
    let board = "g";

    // Getting a specific `Thread` from the board.
    let post_id = 76759434;

    // Fetching a new thread.
    let thread = Thread::new(&client, board, post_id).await.unwrap();
     
    // Getting the OP of the thread.
    let post = thread.op();
    println!("{}", post.image_url(board).unwrap());
}

Modules

board

A cache of the entire board.

catalog

The Catalog consists of the crate::threadlist::Catalog and crate::threadlist::CatalogThreads

post

Holds an information of a single post

thread

Contains information about a 4chan thread.

Structs

Client

The main client for accessing API. Handles updates, board and reqwest::Client

Traits

IfModifiedSince

Helper trait that sends a GET request from the reqwest client with a If-Modified-Since header.

Procedures

Another helper trait for the Update trait.

Update

Update trait specifies if something can be updated or not.