This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let recursive_got = { | |
| fn try_get() -> BoxFuture<'static, String> { | |
| async move { | |
| if something() { | |
| return "hello".to_string(); | |
| } | |
| tokio::time::sleep(Duration::from_millis(500)).await; | |
| try_get(driver).await | |
| } | |
| .boxed() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::future::Future; | |
| use tokio::sync::RwLock; | |
| pub struct Cache<T: Clone> { | |
| item: RwLock<Option<T>>, | |
| } | |
| impl<T: Clone> Cache<T> { | |
| pub fn new() -> Self { | |
| Cache { | |
| item: RwLock::new(None), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl 'https://api.github.com/users/nmrshll/repos' | jq '.[] | .html_url' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use derive_simple::DeriveSimple; | |
| use proc_macro::TokenStream as TokenStream1; | |
| use quote::quote; | |
| use syn::DeriveInput; | |
| #[proc_macro_derive(Simple)] | |
| pub fn derive_simple(input: TokenStream1) -> TokenStream1 { | |
| let derive_simple = DeriveSimple { | |
| input: syn::parse_macro_input!(input as DeriveInput), | |
| }; |
OlderNewer