Skip to content

Commit

Permalink
Fix lifetimes on interaction response methods (#1874)
Browse files Browse the repository at this point in the history
  • Loading branch information
kangalio committed Apr 26, 2022
1 parent 0ba01a7 commit dd9d255
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/builder/create_interaction_response.rs
Expand Up @@ -30,9 +30,9 @@ impl<'a> CreateInteractionResponse<'a> {
/// Sets the `InteractionApplicationCommandCallbackData` for the message.
pub fn interaction_response_data<F>(&mut self, f: F) -> &mut Self
where
for<'b, 'c> F: FnOnce(
&'b mut CreateInteractionResponseData<'c>,
) -> &'b mut CreateInteractionResponseData<'c>,
for<'b> F: FnOnce(
&'b mut CreateInteractionResponseData<'a>,
) -> &'b mut CreateInteractionResponseData<'a>,
{
let mut data = CreateInteractionResponseData::default();
f(&mut data);
Expand Down
10 changes: 7 additions & 3 deletions src/model/interactions/application_command.rs
Expand Up @@ -98,10 +98,14 @@ impl ApplicationCommandInteraction {
/// [`Error::Model`]: crate::error::Error::Model
/// [`Error::Http`]: crate::error::Error::Http
/// [`Error::Json`]: crate::error::Error::Json
pub async fn create_interaction_response<F>(&self, http: impl AsRef<Http>, f: F) -> Result<()>
pub async fn create_interaction_response<'a, F>(
&self,
http: impl AsRef<Http>,
f: F,
) -> Result<()>
where
for<'a, 'b> F:
FnOnce(&'a mut CreateInteractionResponse<'b>) -> &'a mut CreateInteractionResponse<'b>,
for<'b> F:
FnOnce(&'b mut CreateInteractionResponse<'a>) -> &'b mut CreateInteractionResponse<'a>,
{
let mut interaction_response = CreateInteractionResponse::default();
f(&mut interaction_response);
Expand Down

0 comments on commit dd9d255

Please sign in to comment.