I'm trying to write code that requires some basic locking that compiles with no_std and std. For that I'm looking for a Mutex trait implementation that I can either implement myself (e.g. with a spinlock) for no_std and that already has an implementation for std::sync::Mutex.
I've found mutex-trait, which is very close, but doesn't have an implementation for std::sync::Mutex. It's also inconvenient, because it requires a mutable reference to be used, which breaks the usual Arc<Mutex<T>> pattern.
You might also want to look into the lock_api crate, which contains the underlying traits used by parking_lot, a popular alternative to std::sync::Mutex.
See here for an explanation of this design decision.
I found this quite unintuitive, but there seems to be a simple solution as described in the RFC. The only thing missing there is that Mutex<T> has to implement Sync. This might not be the case with RTIC, but in general it's necessary at least for statics (I think).