fix: convert index map/set to hash map/set

fix: idempotency token should use correct crate cfg
This commit is contained in:
Paul Makles
2023-08-27 15:51:20 +01:00
parent a8fc9e928a
commit 5a9bb9e68d
2 changed files with 32 additions and 9 deletions

View File

@@ -329,7 +329,11 @@ impl From<crate::Message> for Message {
embeds: value.embeds,
mentions: value.mentions,
replies: value.replies,
reactions: value.reactions,
reactions: value
.reactions
.into_iter()
.map(|(k, v)| (k, v.into_iter().collect()))
.collect(),
interactions: value.interactions.into(),
masquerade: value.masquerade.map(|masq| masq.into()),
}
@@ -353,7 +357,12 @@ impl From<crate::PartialMessage> for PartialMessage {
embeds: value.embeds,
mentions: value.mentions,
replies: value.replies,
reactions: value.reactions,
reactions: value.reactions.map(|reactions| {
reactions
.into_iter()
.map(|(k, v)| (k, v.into_iter().collect()))
.collect()
}),
interactions: value.interactions.map(|interactions| interactions.into()),
masquerade: value.masquerade.map(|masq| masq.into()),
}
@@ -385,7 +394,9 @@ impl From<crate::SystemMessage> for SystemMessage {
impl From<crate::Interactions> for Interactions {
fn from(value: crate::Interactions) -> Self {
Interactions {
reactions: value.reactions,
reactions: value
.reactions
.map(|reactions| reactions.into_iter().collect()),
restrict_reactions: value.restrict_reactions,
}
}

View File

@@ -4,12 +4,6 @@ use revolt_result::{create_error, Error, Result};
use async_std::sync::Mutex;
use once_cell::sync::Lazy;
use revolt_rocket_okapi::gen::OpenApiGenerator;
use revolt_rocket_okapi::request::{OpenApiFromRequest, RequestHeaderInput};
use revolt_rocket_okapi::revolt_okapi::openapi3::{Parameter, ParameterValue};
use rocket::http::Status;
use rocket::request::{FromRequest, Outcome};
use schemars::schema::{InstanceType, SchemaObject, SingleOrVec};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
@@ -42,6 +36,17 @@ impl IdempotencyKey {
}
}
#[cfg(feature = "rocket-impl")]
use revolt_rocket_okapi::{
gen::OpenApiGenerator,
request::{OpenApiFromRequest, RequestHeaderInput},
revolt_okapi::openapi3::{Parameter, ParameterValue},
};
#[cfg(feature = "rocket-impl")]
use schemars::schema::{InstanceType, SchemaObject, SingleOrVec};
#[cfg(feature = "rocket-impl")]
impl<'r> OpenApiFromRequest<'r> for IdempotencyKey {
fn from_request_input(
_gen: &mut OpenApiGenerator,
@@ -71,6 +76,13 @@ impl<'r> OpenApiFromRequest<'r> for IdempotencyKey {
}
}
#[cfg(feature = "rocket-impl")]
use rocket::{
http::Status,
request::{FromRequest, Outcome},
};
#[cfg(feature = "rocket-impl")]
#[async_trait]
impl<'r> FromRequest<'r> for IdempotencyKey {
type Error = Error;