serpent-os / moss

The safe, fast and sane package manager for Linux
https://serpentos.com
71 stars 9 forks source link

all: Use stdlib OnceLock for HTTP client #253

Closed ReillyBrogan closed 3 weeks ago

ReillyBrogan commented 3 weeks ago

once_cell functionality was integrated into the stdlib in Rust 1.70.0. Switch to it so we can drop once_cell as a dependency.

While OnceLock is functionally similar to the thread-safe modules in once_cell the APIs are somewhat different. In this case the biggest difference is that you can't declare the function that creates the object when you declare the object itself, any caller that wants to use the object needs to provide the function to create it if it does not already exist. This is trivially worked around by wrapping the object in a function, which is what I did here.

ikeycode commented 3 weeks ago

i luv less deps <3