Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- `Observable.choose` as a function of the `Observable` module; like every function of the library that works with optional values it takes a `voption` chooser, and the `option` variant is `ObservableOption.choose`
- `Observable.ofSeq (items)` and `Observable.ofSeq (items, cancellationToken)`, reachable after `open FSharp.Control.R3`
- `Observable.chunkByBoundaries` accepting window boundaries of any element type
- `rxqueryWith cancellationToken` and `RxQueryBuilder (cancellationToken)` to cancel the query operators that return a task

### Changed
Expand Down
13 changes: 13 additions & 0 deletions src/FSharp.Control.R3/Observable.fs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ let inline chunkBy (configuration : ChunkConfiguration<'T>) (source) =
| ChunkAsyncWindow (asyncWindow, configureAwait) -> ObservableExtensions.Chunk (source, asyncWindow, configureAwait)
| ChunkWindowBoundaries windowBoundaries -> ObservableExtensions.Chunk (source, windowBoundaries = windowBoundaries)

// ChunkWindowBoundaries reuses the element type of the source for the boundaries, while R3 ignores the boundary values;
// this function accepts boundaries of any element type, such as Observable<Unit> ticks
/// <summary>
/// Divides the source into chunks that end on every element of <paramref name="windowBoundaries"/>.
/// <para>
/// A boundary element emits the buffered elements, or an empty chunk when nothing is buffered.
/// Completion of the source emits the remaining elements; completion of the boundaries, even a failed one,
/// emits the remaining elements and completes the chunked sequence successfully.
/// </para>
/// </summary>
let inline chunkByBoundaries (windowBoundaries : Observable<'Boundary>) (source : Observable<'T>) =
ObservableExtensions.Chunk (source, windowBoundaries = windowBoundaries)

/// Returns an observable sequence that only contains distinct elements
let inline distinct source = ObservableExtensions.Distinct source

Expand Down
Loading