A little modification of Actix with a large afford
Vee Satayamas
Posted on September 2, 2021
I want to print a log of unparsed #websocket frames used by #awc 2.0.3. If I used Emacs, I'd only add one line of code. However, using Rust and Actix is not that strangeforward. Besides recompilation, I needed to change Cargo.toml to use local crates. For example, in #awc's Cargo.toml, I changed:
actix-codec = "0.3.0"
to
actix-codec = { path = "../../actix-net/actix-codec" }
However, after I recompiled the app, this change caused compilation errors because other crates still use different versions of actix-codec. So I changed all affected crates. I ended up modifying six crates as shown in the figure below.
Moreover, rustc 1.54.0 does not accept this code below:
pub fn as_error<T: ResponseError + 'static>(&self) -> Option<&T> {
ResponseError::downcast_ref(self.cause.as_ref())
}
I presume that a previous version of rustc can. I tried to fix by adding "dyn" as the compiler suggested but it didn't work. So I deleted these three lines. Then rustc 1.54.0 can compile my app and Actix again.
I took too much afford for doing all of these just for printing a little more log. So I wrote this blog out. Maybe I did this in the wrong way. So please suggest to me more proper ways. Or in the worst case, I can read this blog when I forget how did this.
Posted on September 2, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.