git.lukeshu.com/go/lowmemjson@v0.3.9-0.20230723050957-72f6d13f6fb2/reencode_compactws.go (about) 1 // Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> 2 // 3 // SPDX-License-Identifier: GPL-2.0-or-later 4 5 package lowmemjson 6 7 import ( 8 "git.lukeshu.com/go/lowmemjson/internal/jsonparse" 9 ) 10 11 type reEncodeCompactWS struct { 12 out reEncoderModule 13 } 14 15 var _ reEncoderModule = (*reEncodeCompactWS)(nil) 16 17 func (enc *reEncodeCompactWS) PopWriteBarrier() { 18 enc.out.PopWriteBarrier() 19 } 20 21 func (enc *reEncodeCompactWS) HandleRune(c rune, t jsonparse.RuneType, escape BackslashEscapeMode, stackSize int) error { 22 if t == jsonparse.RuneTypeSpace { 23 return nil 24 } 25 26 return enc.out.HandleRune(c, t, escape, stackSize) 27 }