Skip to content

Instantly share code, notes, and snippets.

@DefectingCat
Created January 30, 2024 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DefectingCat/8bed10eb7eafa739791df63e2972526e to your computer and use it in GitHub Desktop.
Save DefectingCat/8bed10eb7eafa739791df63e2972526e to your computer and use it in GitHub Desktop.
rust accept async function in generic
use std::{collections::HashMap, future::Future};
pub struct Rymo<'a, F, Fut>
where
F: FnOnce() -> Fut + 'static + Send + Sync,
Fut: Future<Output = ()>,
{
pub port: String,
pub handle: HashMap<&'a str, F>,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment