github.com/itsabgr/go-handy@v0.0.0-20220724000257-022d51f2b9c6/encoding.go (about)

     1  package handy
     2  
     3  import "encoding"
     4  
     5  func MustMarshalBinary(value encoding.BinaryMarshaler) []byte {
     6  	b, err := value.MarshalBinary()
     7  	Throw(err)
     8  	return b
     9  }
    10  
    11  func MustMarshalText(value encoding.TextMarshaler) []byte {
    12  	txt, err := value.MarshalText()
    13  	Throw(err)
    14  	return txt
    15  }