Wrap src in an anonymous class implementing Targets.
wrap creates an internal wrapper class which implements the
interfaces in Targets using the methods of src, then returns a
GC-allocated instance of it.
Source can be either a class or a struct, but it must
structurally conform with all the Targets
interfaces; i.e. it must provide concrete methods with compatible
signatures of those in Targets.
If Source is a struct then wrapping/unwrapping will
create a copy; it is not possible to affect the original struct
through the wrapper.
Wrap src in an anonymous class implementing Targets.
wrap creates an internal wrapper class which implements the interfaces in Targets using the methods of src, then returns a GC-allocated instance of it.
Source can be either a class or a struct, but it must structurally conform with all the Targets interfaces; i.e. it must provide concrete methods with compatible signatures of those in Targets.
If Source is a struct then wrapping/unwrapping will create a copy; it is not possible to affect the original struct through the wrapper.
The returned object additionally supports unwrap.
Note: If Targets has only one entry and Source is a class which explicitly implements it, wrap simply returns src upcasted to Targets[0].