cast

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package cast provides save casting functions for converting between types without panicking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Array20

func Array20[A any](slice []A) ([20]A, error)

Array20 casts a slice to an array of length 32.

func Array32

func Array32[A any](slice []A) ([32]A, error)

Array32 casts a slice to an array of length 32.

func Array4 added in v0.12.0

func Array4[A any](slice []A) ([4]A, error)

Array4 casts a slice to an array of length 4.

func Array48 added in v0.11.0

func Array48[A any](slice []A) ([48]A, error)

Array48 casts a slice to an array of length 48.

func Array65

func Array65[A any](slice []A) ([65]A, error)

Array65 casts a slice to an array of length 65.

func Array8

func Array8[A any](slice []A) ([8]A, error)

Array8 casts a slice to an array of length 8.

func EthAddress

func EthAddress(b []byte) (common.Address, error)

EthAddress casts a byte slice to an Ethereum address.

func EthHash

func EthHash(b []byte) (common.Hash, error)

EthHash casts a byte slice to an Ethereum hash.

func Must20

func Must20[A any](slice []A) [20]A

Must20 casts a slice to an array of length 20.

func Must32

func Must32[A any](slice []A) [32]A

Must32 casts a slice to an array of length 32.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL