option

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package option provides a typed Some/None carrier for fields that may be present or absent. Pure value semantics — no pointer, no nil. Read Val only when Has is true.

Idiomatic uses include marshalling fields that bind to a ZeroToOne cardinality, configuration values that may be unset, and any API where the difference between "absent" and "zero value" matters.

Index

Constants

This section is empty.

Variables

View Source
var PackageProps = packageprops.Props{
	WASMWASI:         packageprops.WASMCompiles,
	WASMJS:           packageprops.WASMCompiles,
	WASMFreestanding: packageprops.WASMCompiles,
}

PackageProps records this package's curated properties (ADR-0080). Seeded by `boxer code analysis golang wasmsurvey props generate`; curate by hand. The same group's `props verify` reconciles it.

Functions

This section is empty.

Types

type Option

type Option[T any] struct {
	Val T
	Has bool
}

Option is the typed Some/None carrier.

func None

func None[T any]() (opt Option[T])

None returns an absent Option[T] — Has is false and Val carries the zero value of T.

func Some

func Some[T any](v T) (opt Option[T])

Some wraps a value in a present Option[T].

Jump to

Keyboard shortcuts

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