How do I use Any to disambiguate between multiple user-defined structs?

I asked a similar question in Trying to fake downcasts with traits defined on traits. If your IDL gives you an exhaustive list of exceptions that client code can possibly encounter, then the enum-of-references approach is probably the easiest to implement.

I don't think there is an option besides a bare box<Any> in the error arm. The main challenge is that the type ID inside an Any object is chosen at the time of conversion to Any, and if you only have trait object at this point, the type ID will be that of the trait object, and not that of the underlying concrete type.

You can implement custom variants of Any using unsafe code, and such variants could offer the additional traits you want.