Empowering everyone to build reliable and efficient software.
Ephera
link
fedilink
43M

I only really understand half of it without getting my fingers on it, but sounds like some good stuff.

The path::absolute() that’s hidden in the stabilized items is definitely something I’ve wanted for a while, though.

Tmpod
creator
link
fedilink
13M

The two biggest things are lifetime extensions and inline consts. Both will allow you to write more concise code and, in the case of lifetime extensions, may help eliminate some bugs, since you won’t need to work around that limitation anymore.

TehPers
link
fedilink
1
edit-2
3M

Inline consts also let you perform static assertions, like asserting a type parameter is not a zero-sized type, or a const generic is non-zero. This is actually pretty huge since some checks can be moved from runtime to compile time (not a lot of checks, but some that were difficult or impossible to do at compile time before).

I’m not really sure I get the usefulness of this absolute function. It still returns relative paths if the input was relative and it doesn’t resolve “…”. What would you use it for where canonicalize doesn’t work for you?

Ephera
link
fedilink
03M

Well, as it says in the documentation I linked:

unlike canonicalize absolute does not resolve symlinks and may succeed even if the path does not exist.

Primarily, the latter part is what I want. There’s just sometimes situations where a path doesn’t exist (yet), but you want to know what it would look like as an absolute path.

In 99% of those cases you would want it to resolve .. components though.

The lifetime extension is huge.

Rust Programming
!rust@lemmy.ml
    • 0 users online
    • 2 users / day
    • 2 users / week
    • 2 users / month
    • 74 users / 6 months
    • 1 subscriber
    • 258 Posts
    • 707 Comments
    • Modlog