package binarystr import "fmt" // BytePos returns the byte position index immediately leading up to the error. func (b *BadBinCharErr) BytePos() (pos uint64) { return b.posByte } // Rune returns the offending rune that caused the error. func (b *BadBinCharErr) Rune() (r rune) { return b.r } // RunePos returns the rune (character) position index immediately leading up to the error. func (b *BadBinCharErr) RunePos() (pos uint64) { return b.posRune } // Error returns the error message for a BadBinCharError. It conforms to an [error] interface. func (b *BadBinCharErr) Error() (err string) { err = fmt.Sprintf( "rune/character after position index #%d (%#v) (byte #%d) is not \"0\" or \"1\"", b.posRune, b.r, b.posByte, ) return } // String is an alias for the [BadBinCharErr.Error] method to conform explicitly to a [fmt.Stringer] interface. func (b *BadBinCharErr) String() (s string) { return b.Error() }