Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/rimbu/collection-types/set-custom/index.ts>RSetBase.Factory

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
interface RSetBase.Factory
import { type RSetBase } from "https://deno.land/x/rimbu@1.0.3/collection-types/set-custom/index.ts";
const { Factory } = RSetBase;

Type Parameters

Tp extends RSetBase.Types
optional
UT = unknown

Methods

empty<T extends UT>(): WithElem<Tp, T>["normal"]

Returns the (singleton) empty instance of this type and context with given value type.

of<T extends UT>(...values: ArrayNonEmpty<T>): WithElem<Tp, T>["nonEmpty"]

Returns an immutable set of this type and context, containing the given values.

from<T extends UT>(...sources: ArrayNonEmpty<StreamSource.NonEmpty<T>>): WithElem<Tp, T>["nonEmpty"]

Returns an immutable set of this collection type and context, containing the given values in source.

from<T extends UT>(...sources: ArrayNonEmpty<StreamSource<T>>): WithElem<Tp, T>["normal"]
builder<T extends UT>(): WithElem<Tp, T>["builder"]

Returns an empty builder instance for this type of collection and context.

reducer<T extends UT>(source?: StreamSource<T>): Reducer<T, WithElem<Tp, T>["normal"]>

Returns a Reducer that appends received items to an RSet and returns the RSet as a result. When a source is given, the reducer will first create an RSet from the source, and then append elements to it.