9 Apr 2021 |
jplatte | So maybe we should do that too | 08:42:20 |
jplatte | Then there's no need to have the signature of the fn twice | 08:42:36 |
jplatte | * pub trait OutgoingRequestAppserviceExt: OutgoingRequest {
// fn
}
impl<T: OutgoingRequest> OutgoingRequestAppserviceExt for T { }
| 08:42:52 |
jplatte | Update example code above | 08:42:58 |
Johannes Becker | | |_^ type parameter `T` must be used as the type parameter for some local type
|
= note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local
= note: only traits defined in the current crate can be implemented for a type parameter
| 08:50:12 |
Johannes Becker | impl<T: #ruma_api::OutgoingRequest> #ruma_api::OutgoingRequestAppserviceExt for T { | 08:50:55 |
jplatte | Err, are you declaring and implementing OutgoingRequestAppserviceExt in different crates? | 08:51:03 |
jplatte | You're touching the macros? | 08:51:20 |
Johannes Becker | i've declared OutgoingRequestAppserviceExt below OutgoingRequest | 08:51:25 |
jplatte | In reply to @jplatte:flipdot.org
pub trait OutgoingRequestAppserviceExt: OutgoingRequest {
// fn
}
impl<T: OutgoingRequest> OutgoingRequestAppserviceExt for T { }
You just need to add this to ruma-api | 08:51:40 |
jplatte | The macro code can stay as-is | 08:51:53 |
Johannes Becker | oh 🤔 | 08:52:22 |
jplatte | I bet you're more used to some language with interfaces and/or inheritance than Rust, am I right? :) | 08:53:33 |
Johannes Becker | yeah, but i guess the complexity here stems from finding the right mental spot for macro generated things | 08:55:38 |
Johannes Becker | but it makes sense given that i don't need something specific to the request in the Ext | 08:56:40 |
jplatte | After fiddling with it a bunch, it doesn't seem like the serde-style approach helps much, actually. | 13:09:23 |
jplatte | We would have to define our own replacement for the parts of http::header and http::Method we use to drop the http dependency, and I'm not keen on that | 13:10:01 |
jplatte | * We would have to define our own replacement for the parts of http::header and http::Method we use to drop the http dependency, and I'm not keen on that | 13:10:11 |
jplatte | If we keep the http dependency, there is not that much of a point in changing the internal API since we can just hide the type conversions in ruma-client (and for servers we could provide similar higher-level stuff on top of the current abstractions) | 13:11:18 |
jplatte | That said, I've made some progress on replacing Vec<u8> in the API, anybody who wants to know more can follow #481 :) | 13:11:49 |
Github | Redacted or Malformed Event | 13:11:50 |
jplatte | * That said, I've made some progress on replacing Vec<u8> in the API, anybody who wants to know more can follow #481 :) | 13:12:04 |
Github | https://github.com/ruma/ruma/pull/481 : Rework the traits in ruma-api | 13:12:05 |
| MTRNord changed their profile picture. | 23:55:59 |
10 Apr 2021 |
| Ahmed Charles joined the room. | 08:06:12 |
12 Apr 2021 |
Johannes Becker | In reply to @jplatte:flipdot.org You just need to add this to ruma-api ended up with this for now: https://github.com/ruma/ruma/pull/495 | 09:50:47 |
Johannes Becker | thanks for review and merge :3 | 11:33:40 |
| Emelie | Away changed their display name from Emelie to Emelie | Away. | 15:52:08 |
13 Apr 2021 |
| Tomasz Rymkiewicz changed their display name from tomek to Tomasz Rymkiewicz. | 10:23:57 |
| @jplatte:matrix.org left the room. | 14:34:33 |