MCPcopy Create free account
hub / github.com/WICG/webpackage / EncodeBool

Method EncodeBool

go/internal/cbor/encoder.go:158–173  ·  view source on GitHub ↗
(b bool)

Source from the content-addressed store, hash-verified

156}
157
158func (e *Encoder) EncodeBool(b bool) error {
159 ai := byte(0)
160 if b {
161 // True (major type 7, additional information 21)
162 ai = 21
163 } else {
164 // False (major type 7, additional information 20)
165 ai = 20
166 }
167
168 bs := []byte{TypeOther | ai}
169 if _, err := e.w.Write(bs); err != nil {
170 return err
171 }
172 return nil
173}
174
175type MapEntryEncoder struct {
176 keyBuf bytes.Buffer

Callers 1

TestMapEncoderFunction · 0.80

Calls 1

WriteMethod · 0.45

Tested by 1

TestMapEncoderFunction · 0.64