lazy

package
v1.2.23 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IfDefault

func IfDefault[T any](value bool, ifTrue Value[T]) T

IfDefault provides a make-shift ternary operator

func IfElse

func IfElse[T any](value bool, ifTrue Value[T], ifFalse Value[T]) T

IfElse provides a make-shift ternary operator

Types

type Value

type Value[T any] func() T

Value returns a value when invoked

func Const

func Const[T any](v T) Value[T]

Const returns a lazy value which always returns a constant

func Read

func Read[T any](index int, array []T) Value[T]

Read returns a lazy value which returns the value of an array at a given index.

Jump to

Keyboard shortcuts

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