Skip to main content
Version: 1.0.0

Dynamic branches and lists

This reference documents every current public declaration in this part of Pine. Examples run inside App.Mount(), a component factory, or an explicit P.Root(...) unless they only create state/configuration. Explicit P.Mount(...) remains available for advanced ownership. Variable names such as count, items and label refer to the typed values described by each example. All APIs run on Unity’s main thread.

Branch​

Branch<T>

A constructed dynamic result and its optional exit retention delay in seconds.

Branch.Value​

T Value

The native or custom result retained by this branch's scope.

Branch.ExitDelay​

double ExitDelay

Finite non-negative seconds to retain an exiting branch after its presence becomes false.

Branch.Branch​

public Branch(T value, double exitDelay = 0)

Constructs this value with the supplied typed arguments.

Branch.implicit​

public static implicit operator Branch<T>(T value)

Converts a constructed result into a branch with zero exit delay.

P.Show​

public static ReadOnly<IReadOnlyList<TResult>> Show<TResult>(
Func<bool> condition,
Func<TResult> build,
Func<TResult> fallback = null
)

Constructs an owned conditional branch while its condition is true, with an optional fallback.

P.Switch​

public static ReadOnly<IReadOnlyList<TResult>> Switch<TKey, TResult>(
Func<TKey> select,
Func<TKey, TResult> build,
IEqualityComparer<TKey> comparer = null
)

Retains the selected keyed branch and optionally its exiting predecessor.

P.Indexes​

public static ReadOnly<IReadOnlyList<TResult>> Indexes<TValue, TResult>(
Func<IReadOnlyList<TValue>> read,
Func<int, ReadOnly<TValue>, TResult> build
)

Retains rows by index or explicit dictionary key, updating each row's read-only reactive value.

P.Values​

public static ReadOnly<IReadOnlyList<TResult>> Values<TValue, TResult>(
Func<IReadOnlyList<TValue>> read,
Func<TValue, ReadOnly<int>, TResult> build,
IEqualityComparer<TValue> comparer = null
)

Retains rows by value identity and exposes each current index as a read-only reactive value.

P.Switch​

public static ReadOnly<IReadOnlyList<TResult>> Switch<TKey, TResult>(
Func<TKey> select,
Func<TKey, ReadOnly<bool>, Branch<TResult>> build,
IEqualityComparer<TKey> comparer = null
)

Retains the selected keyed branch and optionally its exiting predecessor.

public static ReadOnly<IReadOnlyList<TResult>> Switch<TKey, TResult>(
Func<TKey> select,
IReadOnlyDictionary<TKey, Func<ReadOnly<bool>, Branch<TResult>>> branches,
Func<ReadOnly<bool>, Branch<TResult>> fallback = null
)

Retains the selected keyed branch and optionally its exiting predecessor.

P.Show​

public static ReadOnly<IReadOnlyList<TResult>> Show<TResult>(
Func<bool> condition,
Func<ReadOnly<bool>, Branch<TResult>> build,
Func<ReadOnly<bool>, Branch<TResult>> fallback = null
)

Constructs an owned conditional branch while its condition is true, with an optional fallback.

public static ReadOnly<IReadOnlyList<TResult>> Show<T, TResult>(
Func<T> read,
Predicate<T> truthy,
Func<ReadOnly<T>, ReadOnly<bool>, Branch<TResult>> build,
Func<ReadOnly<bool>, Branch<TResult>> fallback = null
)

Constructs an owned conditional branch while its condition is true, with an optional fallback.

P.Indexes​

public static ReadOnly<IReadOnlyList<TResult>> Indexes<TKey, TValue, TResult>(
Func<IEnumerable<KeyValuePair<TKey, TValue>>> read,
Func<TKey, ReadOnly<TValue>, ReadOnly<bool>, Branch<TResult>> build,
IEqualityComparer<TKey> comparer = null
)

Retains rows by index or explicit dictionary key, updating each row's read-only reactive value.

public static ReadOnly<IReadOnlyList<TResult>> Indexes<TValue, TResult>(
Func<IReadOnlyList<TValue>> read,
Func<int, ReadOnly<TValue>, ReadOnly<bool>, Branch<TResult>> build
)

Retains rows by index or explicit dictionary key, updating each row's read-only reactive value.

P.Values​

public static ReadOnly<IReadOnlyList<TResult>> Values<TValue, TResult>(
Func<IReadOnlyList<TValue>> read,
Func<TValue, ReadOnly<int>, ReadOnly<bool>, Branch<TResult>> build,
IEqualityComparer<TValue> comparer = null
)

Retains rows by value identity and exposes each current index as a read-only reactive value.