News for hackers. Stuff that matters.
Re:Rust solves the problem of incomplete Kernel Linux API docs by bobajeff on Saturday August 31, 2024 @12:52PM (#41410123)
>But the end result of all this is that you CAN, in fact, just look a the Rust API and know how to use it correctly for the most part.

For this I have to bring up that there are indeed rust API's that I have to Google around a bit because I have no way of knowing just by looking at the function signature how to create the type that it expects. Because some types you can't just make from scratch and have to use a combination of other functions to create.

Re:Rust solves the problem of incomplete Kernel Linux API docs by pornel on Saturday August 31, 2024 @01:05PM (#41410217)
It's still an improvement, because you can find what makes that MysteryObject and you know how to pass it to a function that takes a &MysteryObject or Rc<MysteryObject> or other variation.

In C, it's all MysteryObject* and you have no clue if that is a Box, Rc/Arc, &mut, Cow, MutexGuard<MysteryObject>, maybe a slice of &[MysteryObject].

And if you're unlucky you get functions taking or returning void*.

Re:Rust solves the problem of incomplete Kernel Linux API docs by bobajeff on Saturday August 31, 2024 @01:31PM (#41410386)
Well sometimes it's not actually MysteryObject. It's actually some special type like SpecificCaseMysteryObject that's been unified inside of MysteryObject but only MysteryObject is in the signature.
Re:Rust solves the problem of incomplete Kernel Linux API docs by bobbylarrybobby on Saturday August 31, 2024 @01:11PM (#41410259)
I've seen this in Haskell too. “The type signature is self documenting!” Unless you're talking about the most trivial functions, that's almost never the case.
Re:Rust solves the problem of incomplete Kernel Linux API docs by tafia on Wednesday September 04, 2024 @06:29AM (#41443993)
I usually go to docs.rs (or quickly generate it on my pc) then I just search for the functions which returns that object (not a reference of it) or Self.