The goal was to simplify ExternType, but I guess the result was the opposite.
Even so, the handling of input/output parameters and their memory is now in better hands.
In the past we had ExternType trait that defined various types and the actual memory management was left to the IntercomFrom trait, which had to guess about memory ownership based on types (such as *const pointers being borrows and *mut pointers being owned memory).
Now the IntercomFrom traits are gone and the ExternType (or rather the new Externinput/ExternOutput) traits contain the implementation that is responsible for converting values. This allows for better clarity concerning the memory ownership: In general Output parameters pass memory, Input parameters reference memory.
This also clarified the needed conversions a lot. With the use of the old ExternType that had to specify temporary/owned types for some conversions, specifying all the required IntercomFrom´ traits became painful. This change is best seen in thestrings.rs, which has lost over 100 lines since it doesn't need all theIntercomFrom` implementations.
The goal was to simplify
ExternType
, but I guess the result was the opposite.Even so, the handling of input/output parameters and their memory is now in better hands.
In the past we had
ExternType
trait that defined various types and the actual memory management was left to theIntercomFrom
trait, which had to guess about memory ownership based on types (such as*const
pointers being borrows and*mut
pointers being owned memory).Now the
IntercomFrom
traits are gone and theExternType
(or rather the newExterninput
/ExternOutput
) traits contain the implementation that is responsible for converting values. This allows for better clarity concerning the memory ownership: In general Output parameters pass memory, Input parameters reference memory.This also clarified the needed conversions a lot. With the use of the old
ExternType
that had to specify temporary/owned types for some conversions, specifying all the requiredIntercomFrom´ traits became painful. This change is best seen in the
strings.rs, which has lost over 100 lines since it doesn't need all the
IntercomFrom` implementations.