You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/FSharp.Control.TaskSeq/Utils.fs
+9-4Lines changed: 9 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,9 @@ module ValueTaskExtensions =
12
12
typeValueTaskwith
13
13
14
14
/// (Extension member) Gets a task that has already completed successfully.
15
-
static member inlineCompletedTask= Unchecked.defaultof<ValueTask>
15
+
static member inlineCompletedTask=
16
+
// This mimics how it is done in .NET itself
17
+
Unchecked.defaultof<ValueTask>
16
18
17
19
18
20
moduleValueTask =
@@ -26,10 +28,13 @@ module ValueTask =
26
28
let inlineFromResult(x:'T)= ValueTask<'T> x
27
29
28
30
/// Creates a ValueTask with an IValueTaskSource representing the operation
29
-
let inlineofIValueTaskSource taskSource version = ValueTask<bool>(taskSource, version)
31
+
let inlineofSource taskSource version = ValueTask<bool>(taskSource, version)
32
+
33
+
[<Obsolete "From version 0.4.0 onward, 'ValueTask.ofIValueTaskSource' is deprecated in favor of 'ValueTask.ofSource'. It will be removed in an upcoming release.">]
34
+
let inlineofIValueTaskSource taskSource version = ofSource taskSource version
30
35
31
36
/// Creates a ValueTask form a Task<'T>
32
-
let inlineofTask(task:Task<'T>)= ValueTask<'T>(task)
37
+
let inlineofTask(task:Task<'T>)= ValueTask<'T>task
33
38
34
39
/// Ignore a ValueTask<'T>, returns a non-generic ValueTask.
35
40
let inlineignore(vtask:ValueTask<'T>)=
@@ -86,7 +91,7 @@ module Task =
86
91
}
87
92
88
93
/// Create a task from a value
89
-
let inlinefromResult(value:'U):Task<'U>=TaskBuilder.task{returnvalue}
94
+
let inlinefromResult(value:'U):Task<'U>=Task.FromResult value
Copy file name to clipboardExpand all lines: src/FSharp.Control.TaskSeq/Utils.fsi
+12-2Lines changed: 12 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
namespaceFSharp.Control
2
2
3
-
openSystem.Diagnostics
3
+
openSystem
4
4
openSystem.Threading.Tasks
5
5
openSystem.Threading.Tasks.Sources
6
6
@@ -22,7 +22,17 @@ module ValueTask =
22
22
/// Creates a ValueTask with the supplied result of the successful operation.
23
23
val inlineFromResult:x:'T ->ValueTask<'T>
24
24
25
-
/// Creates a ValueTask with an IValueTaskSource representing the operation
25
+
/// <summary>
26
+
/// Initialized a new instance of <see cref="ValueTask" /> with an <see cref="IValueTaskSource" /> representing
27
+
/// representing its operation.
28
+
/// </summary>
29
+
val inlineofSource:taskSource:IValueTaskSource<bool>->version:int16 ->ValueTask<bool>
30
+
31
+
/// <summary>
32
+
/// The function <paramref name="ofIValueTaskSource" /> is deprecated since version 0.4.0,
33
+
/// please use <paramref name="ofSource" /> in its stead. See <see cref="T:FSharp.Control.ValueTask.ofSource" />.
34
+
/// </summary>
35
+
[<Obsolete "From version 0.4.0 onward, 'ValueTask.ofIValueTaskSource' is deprecated in favor of 'ValueTask.ofSource'. It will be removed in an upcoming release.">]
26
36
val inlineofIValueTaskSource:taskSource:IValueTaskSource<bool>->version:int16 ->ValueTask<bool>
0 commit comments