digitalcourage.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
Diese Instanz wird betrieben von Digitalcourage e.V. für die Allgemeinheit. Damit wir das nachhaltig tun können, erheben wir einen jährlichen Vorausbeitrag von 1€/Monat per SEPA-Lastschrifteinzug.

Server stats:

812
active users

#rust

79 posts70 participants4 posts today
IMHO, good design goals for any Rust crate would be that:

1. It should run on your toaster.
2. It should run on #Amiga.

Once I stopped using Cargo and 3rd party crates when making my own crates I've started to enjoy Rust for real :-) IMHO, programming should be fun, not efficient or "productive". If I have to start to be too efficient I'll immediately stop this career.

#rust
Now it is time phase out doing this and detach myself from the grip of hyperfocus ...

https://lore.kernel.org/rust-for-linux/aKUTF6lu5JetDJxX@kernel.org/T/#u

Ton of stuff that I did not do during last three weeks that I should had done (mainly outside of work) so navigating myself to that direction :-) I just could not stop, once I got really started.

Also I sleeping might be good idea once in a while :-)

#linux #kernel #tpm #rust
lore.kernel.orgtpm2_protocol / tpm2sh 0.9.0
12000 SLOC for full TCG TPM 2.0 protocol spefication in three weeks (with about 1000 SLOC of initial code I made year ago).

This includes also tpm2sh. The protocol crate is only ~7000 SLOC.

Now that tpm2_protocol is "complete", I'd believe that it will also slim down over time because first version always the fattest.

I think tpm2_protocol would be the right basis for Linux Rust support for TPM2 but it definitely must mature some time so that low-hanging bugs etc are fixed.

tpm2sh is still quite immature but it is just a test program :-) It has quite a lot of crypto code but use that your own responsibility. I've added that to help with testing now meant for use in production.

#linux #kernel #tpm #rust
Continued thread

OK, one last one because I just got nerdsniped.

Cargo does not have a simple rule about where it will put binaries (`cargo build --profile dev` puts them into `target/debug/`, `cargo build --profile debug` is an error).

It does have a simple rule about where it will install them, which is into a `bin` directory. That `bin` directory can be anywhere, but it must be named `bin`.

These two facts combine to make it difficult to put a binary into a directory of your choice.

Yet another post in the series of of C-senior and Rust-junior posts. I also expose this as group therapy sort of influencing reason i.e, perhaps there are kernel devs with some uncertainty when it comes to Rust.Thus, I expose mine :-)

I seem to do this two-step process a lot with Rust:

1. Refine the code for capability and implement that capability.
2. Decouple the capability from the (sub)crate.

E.g., in 0.7.0 I had reworked the whole code base so that lifetime-parameters would be relaxed and finally it was Any-compatible and I had dyn_eq and those shenanigans in the crate.

i.e., straight up the very first commit after tagging:

https://github.com/puavo-org/tpm2_library/commit/c704938ec64d31a1aaa1b88a3f686d5d25045c0b

I also felt ultimately stupid as I already had e.g. pretty_printer.rs that should have "showed me the way". Still I think it was worth it because of all bottlenecks the codebase had with lifetimes that I could not have noticed w/o first going way too far :-)

Pretty printer for reference: https://github.com/puavo-org/tpm2_library/blob/main/tpm2sh/src/pretty_printer.rs

In my Z-Modem crates next version I'm going to follow the learnings and make it walk and talk like some entity in futures/streams without being coupled to async and of course make it also zero deps:

https://codeberg.org/jarkko/zmodem2/commits/branch/main

I will demonstrate async-ready capability with refined versions of RZM and SZM. Then you can finally have ZModem in your next Tokio project :-)

#linux #rust #kernel
TpmObject created a confusing API because it was not used by the library's
primary parsing functions, which rely on enums. Thus, dynamic dispatch
pattern that was disconnected from the library&...
GitHubrefactor!(tpm2_protocol): move dyn trait out of crate · puavo-org/tpm2_library@c704938TpmObject created a confusing API because it was not used by the library's primary parsing functions, which rely on enums. Thus, dynamic dispatch pattern that was disconnected from the library&...

Whenever someone (usually neurospicy, plural, trans+ fem, and therian) writes about Rust, we find ourselves unclear whether they mean:

:AutismInfinitySymbol: :ADHD_Butterfly: :PluralPrideRingsSymbol: :TransFemHeart: :TherianThetaDeltaSymbol:

Not just that, but considering some of y'all live somewhere auf Deutschland, it's technically possible that you're posting about Rust whilst playing Rust from Rust in Baden-Württemberg!!!

en.wikipedia.orgRust (programming language) - Wikipedia

It's amazing how far const eval has come in #Rust. It wasn't too long ago that even a simple if/else wasn't permitted. Now we're not that far off from having const trait impls and const closures, which will make damn near everything const capable.

I know there's plenty of others involved, but kudos to @oli and Ralf Jung for their endless dedication.

Crazy thought: what if I added another request handler language to #iocaine? What if it was #Rust?

Not quite sure how it would work, but the request handler would be a crate-type = ["cdylib"] thing. That might be even more performant than Roto, and would allow doing a whole lot of things neither the Roto nor the Lua/Fennel engines can (because they're intentionally locked down, while due to the nature of being a cdylib, Rust wouldn't be).

Replied in thread
if false {
  // The panic may or may not occur when the program is built.
  const{ panic!(); }
}

@wingo it seems to me they should have mentioned that it is up to each #Rust implementation how to order optimization passes such as dead code elimination and constant folding, which means the above example may panic during constant folding unless dead code elimination occurs first.