Kriskras99 opened a new issue, #253:
URL: https://github.com/apache/avro-rs/issues/253

   To allow configuring the memory limit and human readable (de)serialisation 
we currently use 
[`std::sync::Once`](https://doc.rust-lang.org/std/sync/struct.Once.html):
   
   
https://github.com/apache/avro-rs/blob/d33d60014563cbe8d7b9050b9362e8fe89e1259a/avro/src/util.rs#L34
   
https://github.com/apache/avro-rs/blob/d33d60014563cbe8d7b9050b9362e8fe89e1259a/avro/src/util.rs#L41
   
   `Once` is a low-level primitive and although correct not really the right 
tool for the job (anymore). Something like 
[`OnceLock::get_or_init`](https://doc.rust-lang.org/std/sync/struct.OnceLock.html#method.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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to