format
This commit is contained in:
parent
6e29fb5fcc
commit
9fb5d188a7
3 changed files with 9 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
use reqwest::Client;
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
use reqwest::Client;
|
||||||
|
|
||||||
use crate::util;
|
use crate::util;
|
||||||
|
|
||||||
|
@ -14,4 +14,4 @@ pub async fn run(http: &Client) -> Result<()> {
|
||||||
println!("{}", table.render());
|
println!("{}", table.render());
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
|
pub mod list;
|
||||||
pub mod search;
|
pub mod search;
|
||||||
pub mod up;
|
pub mod up;
|
||||||
pub mod list;
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use std::unreachable;
|
|
||||||
|
use std::unreachable;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
|
@ -39,8 +40,10 @@ pub async fn cats(http: &Client) -> Result<&Vec<String>> {
|
||||||
|
|
||||||
pub async fn memes(http: &Client) -> Result<&Vec<Meme>> {
|
pub async fn memes(http: &Client) -> Result<&Vec<Meme>> {
|
||||||
if MEMES.get().is_none() {
|
if MEMES.get().is_none() {
|
||||||
let res = http.get("https://data.tilera.xyz/api/jensmemes/memes")
|
let res = http
|
||||||
.send().await?;
|
.get("https://data.tilera.xyz/api/jensmemes/memes")
|
||||||
|
.send()
|
||||||
|
.await?;
|
||||||
let memes = serde_json::from_slice::<MemesResp>(&res.bytes().await?)?;
|
let memes = serde_json::from_slice::<MemesResp>(&res.bytes().await?)?;
|
||||||
|
|
||||||
Ok(MEMES.get_or_init(|| memes.memes))
|
Ok(MEMES.get_or_init(|| memes.memes))
|
||||||
|
|
Loading…
Reference in a new issue