I am trying to design a simple web-service using Gotham for self-education. The service is just a wrapper providing read-write access to some
InternalState struct. I am using stateful handler approach, my
StatefulHanlder struct implement both
Now I have only one instance of
InternalState, so I need to put it behind readers-writer lock.
Naive implementation was to have
internal_state: Arc<RwLock<InternalState>>field in the
StatefulHanlder, but both
I came across qutex crate that seems to be exactly what I need. However, it doesn’t play nice with
the type std::cell::UnsafeCell<std::option::Option<qutex::QrwRequest>> may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
Does that mean I must manually implement an async wrapper above
RwLock? If so, how can do that in non-blocking and efficient manner?