Skip to content

Commit 149ea69

Browse files
committed
Add YieldFrom to CollectionBuilder
1 parent b2afa17 commit 149ea69

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

src/Fabulous.Tests/APISketchTests/TestUI.Widgets.fs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,6 @@ module TestUI_Widgets =
167167
: Content<'msg> =
168168
CollectionBuilder.yieldImpl x
169169

170-
[<Extension>]
171-
static member inline YieldFrom<'msg, 'marker, 'itemMarker when 'msg: equality and 'itemMarker :> IMarker>
172-
(_: CollectionBuilder<'msg, 'marker, IMarker>, x: WidgetBuilder<'msg, 'itemMarker> seq)
173-
: Content<'msg> =
174-
// TODO optimize this one with addMut
175-
{ Widgets = x |> Seq.map(fun wb -> wb.Compile()) |> Seq.toArray |> MutStackArray1.fromArray }
176-
177-
178-
179-
180170
///------------------
181171
type StatefulView<'arg, 'model, 'msg, 'marker when 'msg: equality> =
182172
{ Init: 'arg -> 'model

src/Fabulous/Builders.fs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ type CollectionBuilder<'msg, 'marker, 'itemMarker when 'msg: equality> =
241241

242242
res
243243

244+
member inline _.YieldFrom(sequence: WidgetBuilder<'msg, 'itemMarker> seq) : Content<'msg> =
245+
// TODO optimize this one with addMut
246+
{ Widgets =
247+
sequence
248+
|> Seq.map(fun wb -> wb.Compile())
249+
|> Seq.toArray
250+
|> MutStackArray1.fromArray }
251+
244252
[<EditorBrowsable(EditorBrowsableState.Never)>]
245253
member inline x.AddScalar(attr: ScalarAttribute) =
246254
let struct (scalarAttributes, widgetAttributes, widgetCollectionAttributes, environmentAttributes) =

0 commit comments

Comments
 (0)