Documentation
¶
Index ¶
- Constants
- type String
- func (receiver *String) Bytes() []byte
- func (receiver *String) FromString(value string) error
- func (receiver String) GoString() string
- func (receiver *String) Len() int
- func (receiver *String) MarshalText() (text []byte, err error)
- func (receiver *String) String() string
- func (receiver *String) UnmarshalText(text []byte) error
- type Uint
Constants ¶
const (
ErrOverFlow = erorr.Error("overflow")
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is string that can be 0 to 255 bytes long.
String always takes up exactly 256-bytes of space (regarless of how long the string is).
Internally String is a length-prefixed string. This is also sometimes called a “Pascal String”.
Example usage:
var str bits2048.String
str.FromString("Hello world! 🙂")
func FromString ¶
FromString returns a bits2048.String from a Go string.
If the Go string is longer than 256-bytes then it returns an error.
func MustFromString ¶
MustFromString returns a bits2048.String from a Go string.
If the Go string is longer than 256-bytes then it panics.
func (*String) Bytes ¶
Bytes returns bits2048.String as a Go []byte.
(Note that this does NOT include the length-prefix, onl the string data.)
func (*String) FromString ¶
FromString returns a bits2048.String from a Go string.
If the Go string is longer than 256-bytes then it returns an error.
func (*String) MarshalText ¶
func (*String) UnmarshalText ¶
type Uint ¶
type Uint struct {
// contains filtered or unexported fields
}
Uint is a 2048-bit unsigned-number.
Uint stores the data as an array of uint. And stores it in little-endian order. So that Uint[0] is the least-significant values, and Uint[31] is the most-significant.
func FromUint64 ¶
FromUint64 returns a bits2048.Uint from a Go uint64.
func FromUint64s ¶
func MustFromUint64s ¶
func (*Uint) Cmp ¶
Cmp compared 'receiver' and 'other', and —
It returns 0 if 'receiver' and 'other' are equal. It return -1 if 'receiver' is less-than 'other'. And it return 1 if 'receiver' is greater-than 'other'.