Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 170 for marshalers (0.42 sec)

  1. test/typeparam/issue48185a.dir/p.go

    // license that can be found in the LICENSE file.
    
    package p
    
    type MarshalOptions struct {
    	Marshalers *Marshalers
    }
    
    type Encoder struct {}
    
    type Marshalers = marshalers[MarshalOptions, Encoder]
    
    type marshalers[Options, Coder any] struct{}
    
    func MarshalFuncV1[T any](fn func(T) ([]byte, error)) *Marshalers {
    	return &Marshalers{}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 07 17:38:14 UTC 2021
    - 444 bytes
    - Viewed (0)
  2. src/math/big/intmarsh.go

    		return fmt.Errorf("math/big: cannot unmarshal %q into a *big.Int", text)
    	}
    	return nil
    }
    
    // The JSON marshalers are only here for API backward compatibility
    // (programs that explicitly look for these two methods). JSON works
    // fine with the TextMarshaler only.
    
    // MarshalJSON implements the [encoding/json.Marshaler] interface.
    func (x *Int) MarshalJSON() ([]byte, error) {
    	if x == nil {
    		return []byte("null"), nil
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 2.2K bytes
    - Viewed (0)
  3. src/html/template/js.go

    	// "<!--", "-->", "<![CDATA[", "]]>", or "</script"
    	// in case custom marshalers produce output containing those.
    	// Note: Do not use \x escaping to save bytes because it is not JSON compatible and this escaper
    	// supports ld+json content-type.
    	if len(b) == 0 {
    		// In, `x=y/{{.}}*z` a json.Marshaler that produces "" should
    		// not cause the output `x=y/*z`.
    		return " null "
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:28 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  4. src/encoding/xml/marshal_test.go

    		},
    	},
    
    	// Test omitempty with parent chain; see golang.org/issue/4168.
    	{
    		ExpectXML: `<Strings><A></A></Strings>`,
    		Value:     &Strings{},
    	},
    	// Custom marshalers.
    	{
    		ExpectXML: `<MyMarshalerTest>hello world</MyMarshalerTest>`,
    		Value:     &MyMarshalerTest{},
    	},
    	{
    		ExpectXML: `<MarshalerStruct Foo="hello world"></MarshalerStruct>`,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 18:46:41 UTC 2024
    - 66K bytes
    - Viewed (0)
  5. test/typeparam/issue48185b.dir/a.go

    }
    
    type Decoder1 struct {
    }
    
    func (a *arshalers[Options, Coder]) lookup(fnc func(Options, *Coder, addressableValue) error, t reflect.Type) func(Options, *Coder, addressableValue) error {
    	return fnc
    }
    
    func UnmarshalFuncV2[T any](fn func(UnmarshalOptions1, *Decoder1, T) error) *arshalers[UnmarshalOptions1, Decoder1] {
    	return &arshalers[UnmarshalOptions1, Decoder1]{}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 07 20:37:05 UTC 2021
    - 1K bytes
    - Viewed (0)
  6. pkg/util/protomarshal/protomarshal.go

    	}
    
    	// Marshal from proto to json bytes
    	m := jsonpb.Marshaler{Indent: indent, EnumsAsInts: enumsAsInts}
    	return m.MarshalToString(legacyproto.MessageV1(msg))
    }
    
    func ToJSONWithAnyResolver(msg proto.Message, indent string, anyResolver jsonpb.AnyResolver) (string, error) {
    	if msg == nil {
    		return "", errors.New("unexpected nil message")
    	}
    
    	m := jsonpb.Marshaler{
    		Indent:      indent,
    		AnyResolver: anyResolver,
    	}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Mar 12 10:02:09 UTC 2024
    - 6.6K bytes
    - Viewed (0)
  7. pkg/apis/core/json.go

    limitations under the License.
    */
    
    package core
    
    import "encoding/json"
    
    // This file implements json marshaling/unmarshaling interfaces on objects that are currently marshaled into annotations
    // to prevent anyone from marshaling these internal structs.
    
    var _ = json.Marshaler(&AvoidPods{})
    var _ = json.Unmarshaler(&AvoidPods{})
    
    // MarshalJSON panics to prevent marshalling of internal structs
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Sep 25 18:06:51 UTC 2019
    - 1.2K bytes
    - Viewed (0)
  8. src/encoding/xml/marshal.go

    		start.Name.Local = typ.Name()
    	} else {
    		// Must be a pointer to a named type,
    		// since it has the Marshaler methods.
    		start.Name.Local = typ.Elem().Name()
    	}
    	return start
    }
    
    // marshalInterface marshals a Marshaler interface value.
    func (p *printer) marshalInterface(val Marshaler, start StartElement) error {
    	// Push a marker onto the tag stack so that MarshalXML
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 18:46:41 UTC 2024
    - 31.2K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go

    	if err != nil {
    		return err
    	}
    
    	pd, err := time.ParseDuration(str)
    	if err != nil {
    		return err
    	}
    	d.Duration = pd
    	return nil
    }
    
    // MarshalJSON implements the json.Marshaler interface.
    func (d Duration) MarshalJSON() ([]byte, error) {
    	return json.Marshal(d.Duration.String())
    }
    
    // ToUnstructured implements the value.UnstructuredConverter interface.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Feb 08 00:11:06 UTC 2020
    - 1.9K bytes
    - Viewed (0)
  10. src/encoding/json/encode_test.go

    		t.Errorf("Marshal:\n\tgot:  %s\n\twant: %s", got, want)
    	}
    }
    
    // Ref has Marshaler and Unmarshaler methods with pointer receiver.
    type Ref int
    
    func (*Ref) MarshalJSON() ([]byte, error) {
    	return []byte(`"ref"`), nil
    }
    
    func (r *Ref) UnmarshalJSON([]byte) error {
    	*r = 12
    	return nil
    }
    
    // Val has Marshaler methods with value receiver.
    type Val int
    
    func (Val) MarshalJSON() ([]byte, error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 18:42:28 UTC 2024
    - 29.4K bytes
    - Viewed (0)
Back to top