Although not used (will likely be removed soon) updated version for completeness sake and since i already did it anyway.

This commit is contained in:
Tom 2022-08-17 23:03:47 +02:00
parent 76cb4f18da
commit 314098f68a

View file

@ -130,7 +130,7 @@ async fn get_api_events() -> Vec<Event> {
.get("token")
.expect("Config error, please set the morningstreams[token] value")
.clone()
.into_str()
.into_string()
.expect("Config error, please make sure morningstreams[token] is a string");
let client = reqwest::Client::new();
let req = client
@ -208,7 +208,7 @@ async fn get_f1_events() -> Option<Vec<Event>> {
.get("token")
.expect("Config error, please set the morningstreams[token] value")
.clone()
.into_str()
.into_string()
.expect("Config error, please make sure morningstreams[token] is a string");
let client = reqwest::Client::new();
let req = client
@ -337,15 +337,19 @@ fn build_embed<'a>(event: Event, e: &'a mut CreateEmbed) -> &'a mut CreateEmbed
e
}
#[allow(dead_code)]
async fn autocomplete_series(_ctx: Context<'_>, partial: String) -> impl Stream<Item = String> {
async fn autocomplete_series<'a>(
_ctx: Context<'_>,
partial: &'a str,
) -> impl Stream<Item = String> + 'a {
futures::stream::iter(&["Formula 1", "MotoGP", "IndyCar"])
.filter(move |name| futures::future::ready(name.starts_with(&partial)))
.map(|name| name.to_string())
}
#[allow(dead_code)]
async fn autocomplete_session(_ctx: Context<'_>, partial: String) -> impl Stream<Item = String> {
async fn autocomplete_session<'a>(
_ctx: Context<'_>,
partial: &'a str,
) -> impl Stream<Item = String> + 'a {
futures::stream::iter(&[
"Race",
"Qualifying",