Announcement

Collapse
No announcement yet.

Aya Makes It Easy To Write Rust-Based eBPF Programs For The Linux Kernel

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Aya Makes It Easy To Write Rust-Based eBPF Programs For The Linux Kernel

    Phoronix: Aya Makes It Easy To Write Rust-Based eBPF Programs For The Linux Kernel

    Aya was presented during this week's Linux Plumbers Conference for improving the eBPF developer experience by allowing Rust programs to easily run within the kernel...

    https://www.phoronix.com/scan.php?pa...LPC2021-Update

  • #2
    Rust is very nice but I wish it would support async functions in traits.

    Comment


    • #3
      Originally posted by uid313 View Post
      Rust is very nice but I wish it would support async functions in traits.
      It can be accomplished using https://github.com/dtolnay/async-trait

      If you are talking about async in trait without using dyn traits, then IMHO it will take a lot longer and is likely to be more restricted than the current solution.

      Comment


      • #4
        Originally posted by NobodyXu View Post

        It can be accomplished using https://github.com/dtolnay/async-trait

        If you are talking about async in trait without using dyn traits, then IMHO it will take a lot longer and is likely to be more restricted than the current solution.
        Yes, I am aware there is some crate that provide it, but I wanted it official, native in Rust, also I was thinking about normal traits, not using dyn.

        Comment


        • #5
          Originally posted by uid313 View Post

          Yes, I am aware there is some crate that provide it, but I wanted it official, native in Rust, also I was thinking about normal traits, not using dyn.
          It's possible today using Type Alias Impl Trait. The caveats are that it's currently unstable and it doesn't work with the `async` keyword. You can do something like
          Code:
          trait Foo
          {
              type Bar: Future<Output = whatever>;
              fn foo(&self) -> Self::Bar;
          }
          
          impl Foo for Baz
          {
              type Bar = impl Future<Output = whatever>;
              fn foo(&self) -> Self::Bar
              {
                  ...
              }
          }

          Comment


          • #6
            Originally posted by uid313 View Post

            Yes, I am aware there is some crate that provide it, but I wanted it official, native in Rust, also I was thinking about normal traits, not using dyn.
            You have to understand a languages cannot aim to be a systems programming language and come with a complete runtime at the same time. Everything that is not bein used all the time will forever live in a crate.

            What I would love to see instead (and I've posted this before) is a set of crates officially sanctioned, curated and maintained. But maybe it's too early for that.

            Comment


            • #7
              Originally posted by bachchain View Post

              It's possible today using Type Alias Impl Trait. The caveats are that it's currently unstable and it doesn't work with the `async` keyword. You can do something like...
              As a Rust noob I struggle enough already without workarounds.

              Originally posted by bug77 View Post

              You have to understand a languages cannot aim to be a systems programming language and come with a complete runtime at the same time. Everything that is not bein used all the time will forever live in a crate.

              What I would love to see instead (and I've posted this before) is a set of crates officially sanctioned, curated and maintained. But maybe it's too early for that.
              I am fine with Rust not coming with a complete runtime, I just it to be possible to declare functions as async in the traits, then I use Tokio or async-std to get the async execution runtime.

              Comment


              • #8
                Originally posted by uid313 View Post
                As a Rust noob I struggle enough already without workarounds.

                I just it to be possible to declare functions as async in the traits
                I understand the desire for "it just works", but async is an extremely complicated feature and in many cases implementing "nice to have"s would compromise the design in other areas

                Comment


                • #9
                  Originally posted by uid313 View Post
                  As a Rust noob I struggle enough already without workarounds.
                  And there's your mistake. Don't try to bind the language to your will, try to learn how to work with what it offers. It's painful and it requires unlearning stuff you already know, but it's the only way to learn a ne language properly. God knows I've made that mistake before and I still can't do it naturally.

                  Comment


                  • #10
                    While I don't see anything bad with writing Rust for eBPF, I think it offsets pretty much all of the major advantages of the language. You can't `malloc` in eBPF, you can't use (explicit) concurrency and the limitations imposed by the verifier pretty much make it so it's already safe; it's not like regular systems and programs where Rust shines. Plus, you might stumble across the instruction limit if the output ends up being large.

                    Comment

                    Working...
                    X