These are chat archives for rust-lang/rust

Aug 2018
Roman Proskuryakov
Aug 14 2018 01:00
@omni-viral there is also a i/u 128 type
Aug 14 2018 06:04
@kpp which must be converted to the u64 or usize after calculations.
Roman Proskuryakov
Aug 14 2018 08:07
Aug 14 2018 10:50
Because the API requires u64 in some functions and usize in other functions
Sylwester Rąpała
Aug 14 2018 10:51
Is there a Json Schema generator? I mean I have a struct and I would like to derive JSON schema that can be accepted on request. When I looking I see always just validation or generate Rust code from Json Schema
David Vo
Aug 14 2018 12:29
@xoac: what do you mean by "JSON schema"? if you're asking to be able to serialise/deserialise a struct from/into JSON, you can use serde_json.
Sylwester Rąpała
Aug 14 2018 13:20
Sorry, I am not common with that. I need to generate "JSON Schema" from my struct and get it public. So everybody can know what type of request will be accepted. This can change between version. I can do it manually. Just put some string into code but I would like add some compile-time checking that Rust struct I use. If I forgot check JSON Schema / rust I want error.
I found that do what I want. But I see it's for MongoDB Json Schema. Need to check if I can use it.
Jarred Nicholls
Aug 14 2018 20:31

Any macro experts in? I have a fun puzzle seeing how I can utilize a ty token matcher in the context of a meta token as well as in a type placement. Example:

my_macro!(MyType, ResultType);


struct MyType;

impl SomeTrait<MyType> for SomeType {
    type Result = ResultType;

Notice the ResultType is to be used in both a meta attribute against MyType as well as an associated type. Any suggestions how I could coerce ty properly, or use some nested macro wizardry? I'd rather not require being repetitive in the invocation of my_macro!