Decrusting the axum crate

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ก.ย. 2024

ความคิดเห็น • 109

  • @nick-lehmann
    @nick-lehmann ปีที่แล้ว +434

    Since I didn't find a better place to vote for new videos, I would like to make this the "please do a decrusting tracing" button 🙌🏻

    • @narigoncs
      @narigoncs ปีที่แล้ว +6

      Yes, this would be amazing.

    • @huricane555555
      @huricane555555 ปีที่แล้ว +2

      Yes please!

    • @MichaelEdlinger88
      @MichaelEdlinger88 ปีที่แล้ว +4

      Wow I didn't know I wanted this, but yes please

    • @battatia
      @battatia ปีที่แล้ว +3

      +1 for tracing decrusted!

    • @jonnyso1
      @jonnyso1 ปีที่แล้ว +1

      YEP !

  • @ianakotey
    @ianakotey ปีที่แล้ว +104

    Man, you're such a joy to listen to. Thanks for the work you do for us

  • @indierusty
    @indierusty ปีที่แล้ว +15

    'Decrusting Bevy ECS' next? I really want to know how function is bevy ECS system and it gets it arguments?.

    • @dealloc
      @dealloc ปีที่แล้ว +1

      It's pretty much the same as axum's Handler macro expansion. You can find the implementation in bevy_ecs within exclusive_function_system and exclusive_system_param modules.
      They use a _all_tuples_ macro as well, which is more generic, as they pass number of variadics to implement for, but is nevertheless the same result.

    • @tomaspecl1082
      @tomaspecl1082 7 หลายเดือนก่อน

      I was just thinking that it is basically the same as bevy. The stuff that is made possible by all the traits and impls is really awesome and quite magical. But not that magical now, I kind of know how it works.

    • @indierusty
      @indierusty 7 หลายเดือนก่อน

      @@tomaspecl1082 yes it actually make sense to me now. Also know as Extractor functions. It supprised me how simple and powerful this system is.

  • @romanstingler435
    @romanstingler435 ปีที่แล้ว +32

    If it is possible, don't stop :)
    We love you and your videos

  • @yokebabjr3866
    @yokebabjr3866 ปีที่แล้ว +4

    Does anyone has a link to "Ralph Youngs introduction to providence" mentionned at 2:04:15 ? Google didn't help me on this

    • @jonhoo
      @jonhoo  ปีที่แล้ว +4

      www.ralfj.de/blog/2018/07/24/pointers-and-bytes.html and the two follow up posts he's done :)

  • @mikemikemike444
    @mikemikemike444 ปีที่แล้ว +26

    Hey Jon, just wanted to to poke my head in and compliment you on Rust for Rustaceans. I bought it right when I was starting to learn Rust, with an attitude of, "my goal is to get to a point where I more-or-less understand the things in this book." Now, an embarrassing number of months later, I'm reading it and it's beyond awesome. Thanks man and congrats on surviving the move!

    • @SvenBrettschneider
      @SvenBrettschneider ปีที่แล้ว

      Just bought it :)
      These videos are just so great to watch!

  • @voidsifr
    @voidsifr ปีที่แล้ว +13

    OMG, this stream was AWESOME. I am using axum a ton right now but never really dug into it. This really really demystified it for me. Always enjoy your streams even though I often watch them after the fact. I totally understand axum (and Rust stuff in general) way better now. Thank you for your time and awesome work.

  • @fhools
    @fhools ปีที่แล้ว +12

    I love the decrust series. I'm really looking forward to a deep dive into tracing crate!

  • @Hellbending
    @Hellbending 5 หลายเดือนก่อน +3

    "Tower de-crustin' when?"
    Memes aside - I think this would be the natural progression of the series as you seem to have covered a large portion of the existing Web-Service/Backend crates and associated tooling.
    Only 1/4 the way through and already had a couple of small things click in the back of my mind so I gotta say - thank you for those moments cos they're so rewarding.
    Really appreciate these my man, like I cannot express that enough. Need more people like yourself doing good work via 'teardowns' and longer-form videos where in-depth things actually get/can be discussed like this, keep up the awesomeness brother! ♥

  • @JaLikon65
    @JaLikon65 ปีที่แล้ว +1

    Imagine my surprise as a Rust noob when -- somehow -- at 48mins into an in-depth video how an HTTP Router works, I hear that at the core of this all we need something called "Cow".

  • @jonnyso1
    @jonnyso1 ปีที่แล้ว +4

    As you were introducing Axum I think it would also be worth including that it does provide ways for creating middlewares and extractors that are a little easier than making a tower service directly.

  • @christopher8641
    @christopher8641 ปีที่แล้ว +3

    Incredible stream / video. Really cleared up a lot of thing about web related concepts as well. Been reading your book and it is equally filled with quality tips and scenarios. Rust was basically my first programming language and the experience was truly (,brutally) humbling. But, the "crust" and "decrust" series was what really made me have those "Ohhhhh, that makes sense now" moments.

  • @f-vall
    @f-vall ปีที่แล้ว +2

    "Once you have a web server your bottleneck of the application is not dynamic dispatch, so if you can make the ergonomics of using the tool nicer by doing a Box somewhere, it is probably worthwile."
    Well said 👏

  • @Jayemjigga
    @Jayemjigga ปีที่แล้ว +3

    I'd love to see you decrust Bevy :D I use Axum all the time and this was awesome, thanks Jon!

  • @zoes17
    @zoes17 ปีที่แล้ว +3

    New decrusted from Jon, LET'S GO!

  • @monadoIogy
    @monadoIogy ปีที่แล้ว +1

    Please decrust more of the tokio ecosystem!

  • @pmulard
    @pmulard 4 วันที่ผ่านมา

    I was extending a bunch of handlers in my web server tonight, and was stuck with compiler errors that I couldn’t figure out. “Handler trait wasn’t satisfied”… I took a much needed break, poured a glass of wine, and watched some TH-cam. Eventually this video came up and I thought, what the heck, I’m working with Axum.
    Turns out 53:50 was exactly the solution to my problem. I’m passing in State, Path, and Json into my handlers and the order was wrong. Json was first and it needed to be last. Talk about some divine intervention. Thank you so much for these videos and all you do Jon! They are always a pleasure to watch, even when you aren’t bailing me out.

  • @YTCrazytieguy
    @YTCrazytieguy ปีที่แล้ว +1

    Is the `==` trait bound syntax documented anywhere? it seems really useful

  • @midewestmond9442
    @midewestmond9442 ปีที่แล้ว +3

    Thanks 😊

  • @bozhidaratanasov7800
    @bozhidaratanasov7800 ปีที่แล้ว +1

    Building medium-large sized type hierarchies, like the one you went through with tower::Service and Handler traits, is a skill I am seriously lacking. Would you have a recommended course of action for me or do you think it's something that comes with experience?

  • @JamesBlachly-f2k
    @JamesBlachly-f2k ปีที่แล้ว +2

    You do a great job explaining complex topics. I watched this start-to-finish, which is rare these days. Thank you!

  • @Wodziwob
    @Wodziwob 8 หลายเดือนก่อน +1

    I just hit the incorrect fromrequest vs from fromrequestparts param order thing with the unhelpful compiler message. Your video helped me understand the reason why it acts that way. SO HELPFUL. Thank you so much for doing these.

  • @dealloc
    @dealloc ปีที่แล้ว +1

    It's a very interesting pattern, which Bevy also uses and makes it quite easy to work with. Although I have read somewhere that there are some downsides to this pattern, regardless of compile time, but haven't dug deeper into it.
    It would be nice if variadics were supported at syntax level in Rust. But as I understand it, it's not so easy since Rust would need to add variadic types for generics and functions while keeping its error and debug diagnostics easy to read as well.

  • @rsjeyt
    @rsjeyt ปีที่แล้ว +1

    You're amazing. I literally needed this right now.

  • @sebatustra1
    @sebatustra1 ปีที่แล้ว +2

    yoo good stuuuff

  • @blakewilloughby398
    @blakewilloughby398 ปีที่แล้ว +1

    Axum is a great crate! This video is awesome! Thank you sir!❤

  • @cherloire7978
    @cherloire7978 ปีที่แล้ว +6

    You should do leptos as well :)

    • @leonie9248
      @leonie9248 ปีที่แล้ว

      +1 for Leptos!

  • @Tarekconqueso
    @Tarekconqueso 5 หลายเดือนก่อน

    this is a goldmine. Man i wish i was present during the stream, i have so many questions :DD

  • @谢智斌-q9l
    @谢智斌-q9l ปีที่แล้ว +1

    Could you have a stream for simply implementing an executor? It is hard to figure out what happened behind spawn and how does tokio implement Future. This trait is rarely implemented by normal applications, it just like magical.

    • @VivekYadav-ds8oz
      @VivekYadav-ds8oz ปีที่แล้ว +1

      ++++++ I been saying this for SO LONG!

  • @buildingblockdev
    @buildingblockdev 23 วันที่ผ่านมา

    Please do descripting actix and actix-web

  • @tilakmadichettitheappdeveloper
    @tilakmadichettitheappdeveloper ปีที่แล้ว

    Lichess open explorer uses the box leak trick too !

  • @gritcrit4385
    @gritcrit4385 ปีที่แล้ว

    1:58:27 What if we used lazy_static?

  • @VivekYadav-ds8oz
    @VivekYadav-ds8oz ปีที่แล้ว +1

    Day N+1 of asking Jon to make a video on creating your own little async/await library/executor.

    • @jonhoo
      @jonhoo  ปีที่แล้ว

      You mean like th-cam.com/video/9_3krAQtD2k/w-d-xo.html :)

    • @VivekYadav-ds8oz
      @VivekYadav-ds8oz ปีที่แล้ว +1

      @@jonhoo I think I had watched this some years ago when I was even dumber and new to Rust. Now I don't quite remember what it exactly talked about, but I'm not sure it _really_ showed how to implement an Executor 😅

  • @LucasFernandes-zs5nr
    @LucasFernandes-zs5nr ปีที่แล้ว

    you got a new subscriber just by the title 😅

  • @arlaxia
    @arlaxia 4 หลายเดือนก่อน

    This was perfect, exactly what I needed. I was taking my first steps in Rust web dev recently and was trying to look around axum source code to find out how it did the "handler magic", but couldn't quite figure it out. You explained it fantastically.

  • @ChefOnACloud
    @ChefOnACloud ปีที่แล้ว

    ah, the type pattern for State is so clever, you can kind of read it as "Still needs to be provided with an S", thus it makes sense that you can only call serve if `S` is `()`. Feels like the inverse of the `ApiBuilder, ApiBuilder` pattern, where instead of denoting what you have it denotes what you need, making it more generic and useful, since you're using actual required types instead of just markers

  • @StephenLin-ns8kx
    @StephenLin-ns8kx ปีที่แล้ว

    Hi Jon, thanks for the video! Definitely learned a bunch watching 🙂
    I have some trouble wrapping my head around the into_make_service() function. The docs explanation was a bit vague for me, stating MakeService is a Service whose response is another Service. Could you help clarify what this is meant to do?

  • @crabbaby91
    @crabbaby91 ปีที่แล้ว

    Really helpful! I think the reason why we can't swap the Json and AppenderHeaders at 1:0815 is that Json doesn't impl IntoResponseParts, since the AppenderHeaders impls IntoResponse so it can be the last param. anyway, it doesn't affect the result.

  • @willemmeints3123
    @willemmeints3123 3 หลายเดือนก่อน

    I took me three sittings to get through all the content. I'm happy you made this recording. I tried to make sense of everything that's documented but it's hard if you're learning rust and only built one or two applications with it. This is a great walk through with much needed hints to get beyond the basic compile errors!

  • @barmetler
    @barmetler 10 หลายเดือนก่อน

    You're almost typing as fast as you're speaking. I wish I was that fast, but my hands are really holding me back in day to day life XD

  • @Bob-nc5hz
    @Bob-nc5hz ปีที่แล้ว

    1:13:00 an alternative to "type erasing" (converting to a Response inside the handler) is to return a `Result`, which is one of the reasons I switched over from Warp (which uses Result for something else so you can't use it for diverging results). The more reliable type-checking is why I personally prefer fully typing most of my axum handlers, rather than using `impl IntoResponse` or `Response`, it's too easy to miss some of the bits you wanted to include then (especially when you use a uniform handler error and Result, in API contexts you probably always want to be sure the error value is the application's error type).

  • @najibullahkhodarahim1698
    @najibullahkhodarahim1698 ปีที่แล้ว

    Can you decrust tonic?! 😊

  • @bok9201
    @bok9201 9 หลายเดือนก่อน

    Excellent content. For us Rust beginners, an example of how to write a handler for a custom response type such as a struct of several strings and a Vec[ ] or similar non-standard types would be useful, but perhaps too basic for your typical audience.

  • @jonasPlatte
    @jonasPlatte ปีที่แล้ว

    The moment you started looking for `into_route`, I knew it was going to be ~impossible to explain 😂

  • @papafrancesco8782
    @papafrancesco8782 ปีที่แล้ว

    If im not mistaken, this looks a lot like the strategy bevy uses to implement its system architecture. Its crazy to me how a technology so complicated and rust type system dependent that its essentially impossible in any systems level language thats not rust is so widespread in the ecosystem. Great explanation. I once combed through source code for hours trying to figure out how the hell bevy knew at compiletime which system params to pass to which functions. Crazy stuff

  • @knowledgedose1956
    @knowledgedose1956 ปีที่แล้ว

    Hey Jon, thanks for soooo much info! Friendly suggestion to set up a telegram group or even channel for new video announcements, topic polls etc

  • @andredasilva6807
    @andredasilva6807 ปีที่แล้ว

    please keep on doing these streams. even if its not possible to catch it live. its fantastic to watch as a video :) its always amazing to look at a crate or a topic in rust in more detail. and i think everyone learns a lot from it. As you mentioned tracing would be really intresting to decrust. Or maybe sqlx. espacially the query / query_as macros. I am currtently using actix which would be really intresting to decrust too. But i think with axum you already have covered a great web framework ;).

  • @Mahmudul_Hasan92
    @Mahmudul_Hasan92 10 หลายเดือนก่อน

    Thank you for continuing to share your knowledge. These streams are invaluable to me personally, and I sincerely hope that you stay mentally, physically and financially healthy to keep doing them.

  • @JR-wu3rx
    @JR-wu3rx 10 หลายเดือนก่อน

    Thank you so much for making these videos. Honestly there are not many Rust videos where they actually break down the code to understand the design and structure to make me a more informed programmer. They seem to be mostly surface level how-to videos.

  • @nazarm6215
    @nazarm6215 ปีที่แล้ว

    Axum has "type checking" for tcp/http requests? That's sweet.

  • @flwi
    @flwi 6 หลายเดือนก่อน

    You're soo good at explaining things! I learned a lot and had fun following your explanations along the way!

  • @EmoPorEmilio
    @EmoPorEmilio ปีที่แล้ว

    wow, if a handler panics it only panics on that handler task? the web server keeps working. I had no idea. that is so crazy good.

  • @gritcrit4385
    @gritcrit4385 ปีที่แล้ว

    Axum and tower have so much confusing types if you're not good at type-fu

  • @elichai2
    @elichai2 ปีที่แล้ว

    Hi! I love your videos and it is the best advanced video content on rust out there.
    I will just say that the amount of red errors on the screen really make it hard to ignore and focus on the code, R-A can be too aggressive for my eyes lol

  • @w1keee
    @w1keee ปีที่แล้ว

    hey, i think it would be interesting to decrust the futures crate, because it has useful async types like Stream or Sink

  • @谢智斌-q9l
    @谢智斌-q9l ปีที่แล้ว

    Could you have a stream for simply implementing an executor? It is hard to figure out what happened behind spawn and how does tokio implement Future. This trait is rarely implemented by normal applications, it just like magical.

    • @jonhoo
      @jonhoo  ปีที่แล้ว

      You mean like th-cam.com/video/9_3krAQtD2k/w-d-xo.html :)

    • @谢智斌-q9l
      @谢智斌-q9l ปีที่แล้ว

      Oh I mean is to make a "implement" series of videos. I heard that smol had only 1,500 lines of code in the early days.That'll be cool@@jonhoo

  • @CamaradaArdi
    @CamaradaArdi ปีที่แล้ว

    Adding a feature to a crate you're importing is easier if you do cargo add [crate] -F [feature]

  • @sildcave3926
    @sildcave3926 ปีที่แล้ว

    Thank you for all your work, your videos are extremely usefull

  • @RobertKing
    @RobertKing 15 วันที่ผ่านมา

    Thanks

  • @vimau010
    @vimau010 7 หลายเดือนก่อน

    Thanks!

  • @coldsir5406
    @coldsir5406 ปีที่แล้ว

    Is the vim config public?

  • @cooldude3010
    @cooldude3010 ปีที่แล้ว

    Respectfully: you are goated.

  • @jokicnikola07
    @jokicnikola07 ปีที่แล้ว

    Thanks!

  • @aihuynh1504
    @aihuynh1504 ปีที่แล้ว

    Thanks!

  • @CamaradaArdi
    @CamaradaArdi ปีที่แล้ว

    I'd love s decrusting Tokio episode

  • @MattWrightMTB
    @MattWrightMTB ปีที่แล้ว

    Is there anyway we can download these somewhere?

  • @DHorse
    @DHorse ปีที่แล้ว

    You display a deep knowledge.

  • @polares8187
    @polares8187 ปีที่แล้ว

    Every time it is a pleasure to watch

  • @edcunningham5562
    @edcunningham5562 ปีที่แล้ว

    such a good stream, thanks man!

  • @erikgrundy
    @erikgrundy ปีที่แล้ว +2

    It's fascinating to see how you can do all this sort of thing with a strong type system and compile time inference. as opposed to how much of what I see in other languages is based on runtime and reflection trickery

  • @mustafazakiassagaf1757
    @mustafazakiassagaf1757 ปีที่แล้ว

    thanks for the video Jon

  • @underflowexception
    @underflowexception ปีที่แล้ว

    Awesome thank you

  • @ohmyv3gatron
    @ohmyv3gatron ปีที่แล้ว

    This is gold! 😊😊

  • @jaydendangvu
    @jaydendangvu ปีที่แล้ว

    Love you Jon!

  • @johnw.8782
    @johnw.8782 ปีที่แล้ว

    Thanks!

  • @bramble-east
    @bramble-east ปีที่แล้ว +1

    Me, a Python developer: "Look what they need to mimic a fraction of *args, **kwargs power".

  • @nathanoy_
    @nathanoy_ ปีที่แล้ว +1

    In your description it still says "For more details about serde, see ". Seemingly pasted from the serde video, you may want to edit the description. Awesome video btw, this is exactly the content ive been looking for soo long.

    • @jonhoo
      @jonhoo  ปีที่แล้ว +1

      Oops, good catch, fixed! Thanks 🎉

  • @Loige
    @Loige ปีที่แล้ว

    Great video as usual! Thanks, Jon. Now looking forward to the tracing one. Been playing a bit with it, but I am sure your decrusting of the library will make me understand it much more in depth!

  • @echoptic775
    @echoptic775 ปีที่แล้ว

    I like rust, but i hate when i see things like that macro for all tuples. Why cant anything be inferred so you dont need to do dumb things like that

  • @eudrino
    @eudrino ปีที่แล้ว

    great stream, thank you for sharing.
    i'm not a big fan of axum's approach to solve this, it is a nice experiment tho.
    also, i've noticed that alot of the missing time went into searching for implementation, so maybe you could implement it yourself like the hashmap vod.
    also maybe we can get bigger fonts, been squinting on my phone the whole time xd

  • @christianburke4220
    @christianburke4220 ปีที่แล้ว

    first

  • @gang_albanii
    @gang_albanii ปีที่แล้ว

    thank you. ive discovered axum fairly recently and for me, a young rustacean, it was black box.