-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
To allow configuring the memory limit and human readable (de)serialisation we currently use std::sync::Once
:
Line 34 in d33d600
static MAX_ALLOCATION_BYTES_ONCE: Once = Once::new(); |
Line 41 in d33d600
static SERDE_HUMAN_READABLE_ONCE: Once = Once::new(); |
Once
is a low-level primitive and although correct not really the right tool for the job (anymore). Something like OnceLock::get_or_init
provides the same functionality as Once
+ AtomicUsize/Bool
in a much nicer API.
But I also think only allowing it to be set once is not necessarily the right thing either. I can imagine a program that might want to increase its limit if it encounters files that are too large iff the computer it's running on has spare resources.
Metadata
Metadata
Assignees
Labels
No labels