Example #1
0
// Serialize serializes the underlying block if it is
// a serializer.Serializer (and fails otherwise).
func (b *BlockSeqFunc) Serialize() ([]byte, error) {
	s, ok := b.B.(serializer.Serializer)
	if !ok {
		return nil, fmt.Errorf("type is not a Serializer: %T", b.B)
	}
	return serializer.SerializeWithType(s)
}
Example #2
0
// Serialize attempts to serialize this block by
// serializing the wrapped block.
// If the wrapped block is not a serializer.Serializer,
// this will fail.
func (s *StateOutBlock) Serialize() ([]byte, error) {
	ser, ok := s.Block.(serializer.Serializer)
	if !ok {
		return nil, fmt.Errorf("type is not a Serializer: %T", s.Block)
	}
	return serializer.SerializeWithType(ser)
}