/**
* @since 1.0.0
*/
import type * as Option from "@effect/data/Option";
import type { Pipeable } from "@effect/data/Pipeable";
import type * as Effect from "@effect/io/Effect";
import * as Synchronized from "@effect/io/SynchronizedRef";
import type * as Stream from "@effect/stream/Stream";
/**
* @since 1.0.0
* @category symbols
*/
export declare const SubscriptionRefTypeId: unique symbol;
/**
* @since 1.0.0
* @category symbols
*/
export type SubscriptionRefTypeId = typeof SubscriptionRefTypeId;
/**
* A `SubscriptionRef` is a `Ref` that can be subscribed to in order to
* receive the current value as well as all changes to the value.
*
* @since 1.0.0
* @category models
*/
export interface SubscriptionRef extends SubscriptionRef.Variance, Synchronized.SynchronizedRef, Pipeable {
/**
* A stream containing the current value of the `Ref` as well as all changes
* to that value.
*/
readonly changes: Stream.Stream;
}
/**
* @since 1.0.0
*/
export declare namespace SubscriptionRef {
/**
* @since 1.0.0
* @category models
*/
interface Variance {
readonly [SubscriptionRefTypeId]: {
readonly _A: (_: never) => A;
};
}
}
/**
* @since 1.0.0
* @category getters
*/
export declare const get: (self: SubscriptionRef) => Effect.Effect;
/**
* @since 1.0.0
* @category utils
*/
export declare const getAndSet: {
(value: A): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, value: A): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const getAndUpdate: {
(f: (a: A) => A): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, f: (a: A) => A): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const getAndUpdateEffect: {
(f: (a: A) => Effect.Effect): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, f: (a: A) => Effect.Effect): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const getAndUpdateSome: {
(pf: (a: A) => Option.Option): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, pf: (a: A) => Option.Option): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const getAndUpdateSomeEffect: {
(pf: (a: A) => Option.Option>): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, pf: (a: A) => Option.Option>): Effect.Effect;
};
/**
* Creates a new `SubscriptionRef` with the specified value.
*
* @since 1.0.0
* @category constructors
*/
export declare const make: (value: A) => Effect.Effect>;
/**
* @since 1.0.0
* @category utils
*/
export declare const modify: {
(f: (a: A) => readonly [B, A]): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, f: (a: A) => readonly [B, A]): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const modifyEffect: {
(f: (a: A) => Effect.Effect): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, f: (a: A) => Effect.Effect): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const modifySome: {
(fallback: B, pf: (a: A) => Option.Option): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, fallback: B, pf: (a: A) => Option.Option): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const modifySomeEffect: {
(fallback: B, pf: (a: A) => Option.Option>): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, fallback: B, pf: (a: A) => Option.Option>): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const set: {
(value: A): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, value: A): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const setAndGet: {
(value: A): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, value: A): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const update: {
(f: (a: A) => A): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, f: (a: A) => A): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const updateEffect: {
(f: (a: A) => Effect.Effect): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, f: (a: A) => Effect.Effect): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const updateAndGet: {
(f: (a: A) => A): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, f: (a: A) => A): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const updateAndGetEffect: {
(f: (a: A) => Effect.Effect): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, f: (a: A) => Effect.Effect): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const updateSome: {
(f: (a: A) => Option.Option): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, f: (a: A) => Option.Option): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const updateSomeEffect: {
(pf: (a: A) => Option.Option>): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, pf: (a: A) => Option.Option>): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const updateSomeAndGet: {
(pf: (a: A) => Option.Option): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, pf: (a: A) => Option.Option): Effect.Effect;
};
/**
* @since 1.0.0
* @category utils
*/
export declare const updateSomeAndGetEffect: {
(pf: (a: A) => Option.Option>): (self: SubscriptionRef) => Effect.Effect;
(self: SubscriptionRef, pf: (a: A) => Option.Option>): Effect.Effect;
};
//# sourceMappingURL=SubscriptionRef.d.ts.map