fix: convert index map/set to hash map/set
fix: idempotency token should use correct crate cfg
This commit is contained in:
@@ -329,7 +329,11 @@ impl From<crate::Message> for Message {
|
|||||||
embeds: value.embeds,
|
embeds: value.embeds,
|
||||||
mentions: value.mentions,
|
mentions: value.mentions,
|
||||||
replies: value.replies,
|
replies: value.replies,
|
||||||
reactions: value.reactions,
|
reactions: value
|
||||||
|
.reactions
|
||||||
|
.into_iter()
|
||||||
|
.map(|(k, v)| (k, v.into_iter().collect()))
|
||||||
|
.collect(),
|
||||||
interactions: value.interactions.into(),
|
interactions: value.interactions.into(),
|
||||||
masquerade: value.masquerade.map(|masq| masq.into()),
|
masquerade: value.masquerade.map(|masq| masq.into()),
|
||||||
}
|
}
|
||||||
@@ -353,7 +357,12 @@ impl From<crate::PartialMessage> for PartialMessage {
|
|||||||
embeds: value.embeds,
|
embeds: value.embeds,
|
||||||
mentions: value.mentions,
|
mentions: value.mentions,
|
||||||
replies: value.replies,
|
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()),
|
interactions: value.interactions.map(|interactions| interactions.into()),
|
||||||
masquerade: value.masquerade.map(|masq| masq.into()),
|
masquerade: value.masquerade.map(|masq| masq.into()),
|
||||||
}
|
}
|
||||||
@@ -385,7 +394,9 @@ impl From<crate::SystemMessage> for SystemMessage {
|
|||||||
impl From<crate::Interactions> for Interactions {
|
impl From<crate::Interactions> for Interactions {
|
||||||
fn from(value: crate::Interactions) -> Self {
|
fn from(value: crate::Interactions) -> Self {
|
||||||
Interactions {
|
Interactions {
|
||||||
reactions: value.reactions,
|
reactions: value
|
||||||
|
.reactions
|
||||||
|
.map(|reactions| reactions.into_iter().collect()),
|
||||||
restrict_reactions: value.restrict_reactions,
|
restrict_reactions: value.restrict_reactions,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,6 @@ use revolt_result::{create_error, Error, Result};
|
|||||||
|
|
||||||
use async_std::sync::Mutex;
|
use async_std::sync::Mutex;
|
||||||
use once_cell::sync::Lazy;
|
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};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[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 {
|
impl<'r> OpenApiFromRequest<'r> for IdempotencyKey {
|
||||||
fn from_request_input(
|
fn from_request_input(
|
||||||
_gen: &mut OpenApiGenerator,
|
_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]
|
#[async_trait]
|
||||||
impl<'r> FromRequest<'r> for IdempotencyKey {
|
impl<'r> FromRequest<'r> for IdempotencyKey {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|||||||
Reference in New Issue
Block a user