fstate

package
v0.0.0-...-352b2cc Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package fstate provides interaction betweeen Fyne and state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromBinding

func FromBinding[T any, B Binding[T]](b B) state.MutableState[T]

FromBinding returns a state that defers to a Fyne data binding.

TODO: Handle errors somehow.

func ToListBinding

func ToListBinding[T any, S state.State[T], L ~[]S](s state.State[L]) binding.DataList

ToListBinding creates a binding.DataList from a state.State containing a slice of States.

func ToSliceOfStates

func ToSliceOfStates[T any, L ~[]T, S state.State[L]](s S) state.State[[]state.State[T]]

ToSliceOfStates returns a state derived from s that wraps each element in a state.Static. This is useful for, for example, simple usages of fyner.List.

Types

type Binding

type Binding[T any] interface {
	binding.DataItem
	Get() (T, error)
	Set(T) error
}

Binding represents a generic Fyne data binding.

func ToBinding

func ToBinding[T any](s state.State[T]) Binding[T]

ToBinding creates a Binding from a state.State.

Jump to

Keyboard shortcuts

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