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
//! Exports a single macro named make_deserializable that can be used in place of #[derive(serde::Deserialize)] on structs. | |
//! Supports regular structs and tuple structs of u64. | |
//! Only works with JSON deserialization. | |
//! | |
//! Eg: make_deserializable!(struct Foo { bar: String, baz: i32, }); | |
//! Eg: make_deserializable!(struct Bar(u64)); | |
macro_rules! impl_deserialize_struct { | |
(struct $struct_name:ident { | |
$($field_name:ident: $field_type:ty,)* |
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
async function first<T>(promises: Promise<T>[]): Promise<T> { | |
const rejections: any[] = []; | |
for (const promise of promises) { | |
try { | |
return await promise; | |
} | |
catch (reason) { | |
rejections.push(reason); | |
} |
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
async function any<T>(promises: Promise<T>[]): Promise<T> { | |
const rejections: any[] = []; | |
for (const promise of promises) { | |
try { | |
return await promise; | |
} | |
catch (reason) { | |
rejections.push(reason); | |
} |
NewerOlder