...

Source file src/github.com/mailru/easyjson/tests/nested_marshaler.go

Documentation: github.com/mailru/easyjson/tests

     1  package tests
     2  
     3  import (
     4  	"github.com/mailru/easyjson"
     5  	"github.com/mailru/easyjson/jlexer"
     6  	"github.com/mailru/easyjson/jwriter"
     7  )
     8  
     9  //easyjson:json
    10  type NestedMarshaler struct {
    11  	Value easyjson.MarshalerUnmarshaler
    12  	Value2 int
    13  }
    14  
    15  type StructWithMarshaler struct {
    16  	Value int
    17  }
    18  
    19  func (s *StructWithMarshaler) UnmarshalEasyJSON(w *jlexer.Lexer) {
    20  	s.Value = w.Int()
    21  }
    22  
    23  func (s *StructWithMarshaler) MarshalEasyJSON(w *jwriter.Writer) {
    24  	w.Int(s.Value)
    25  }
    26  
    27  

View as plain text