forked from nullstyle/go-xdr
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Marshaler and Unmarshaler interfaces
Add Marshaler and Unmarshaler interfaces, which allow for custom encoding/decoding working similarly to encoding/json Marshaler and Unmarshaler: ``` type Marshaler interface { MarshalXDR(e *Encoder) (int, error) } type Unmarshaler interface { UnmarshalXDR(e *Decoder) (int, error) } ``` The Decoder and Encoder automatically call the relevant methods if found. Both implementation by value and by pointer are supported. A new error (`ErrCustomUnaddressableByPointer`) will be returned if a by-pointer implementation is found but the value passed is unaddressable (not allowing to call the method by pointer).
- Loading branch information
Showing
5 changed files
with
270 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.