New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove System.Interactive.Async dependency #19059
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#region Copyright notice and license | ||
|
||
// Copyright 2015 gRPC authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#endregion | ||
|
||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace Grpc.Core | ||
{ | ||
/// <summary> | ||
/// Extension methods for <see cref="IAsyncStreamReader{T}"/>. | ||
/// </summary> | ||
public static class AsyncStreamReaderExtensions | ||
{ | ||
/// <summary> | ||
/// Advances the stream reader to the next element in the sequence, returning the result asynchronously. | ||
/// </summary> | ||
/// <typeparam name="T">The message type.</typeparam> | ||
/// <param name="streamReader">The stream reader.</param> | ||
/// <returns> | ||
/// Task containing the result of the operation: true if the reader was successfully advanced | ||
/// to the next element; false if the reader has passed the end of the sequence. | ||
/// </returns> | ||
public static Task<bool> MoveNext<T>(this IAsyncStreamReader<T> streamReader) | ||
where T : class | ||
{ | ||
if (streamReader == null) | ||
{ | ||
throw new ArgumentNullException(nameof(streamReader)); | ||
} | ||
|
||
return streamReader.MoveNext(CancellationToken.None); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Copyright notice and license | ||
#region Copyright notice and license | ||
|
||
// Copyright 2015 gRPC authors. | ||
// | ||
|
@@ -16,10 +16,7 @@ | |
|
||
#endregion | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace Grpc.Core | ||
|
@@ -50,7 +47,20 @@ namespace Grpc.Core | |
/// </para> | ||
/// </summary> | ||
/// <typeparam name="T">The message type.</typeparam> | ||
public interface IAsyncStreamReader<T> : IAsyncEnumerator<T> | ||
public interface IAsyncStreamReader<T> | ||
{ | ||
/// <summary> | ||
/// Gets the current element in the iteration. | ||
/// </summary> | ||
T Current { get; } | ||
|
||
/// <summary> | ||
/// Advances the reader to the next element in the sequence, returning the result asynchronously. | ||
/// </summary> | ||
/// <param name="cancellationToken">Cancellation token that can be used to cancel the operation.</param> | ||
/// <returns> | ||
/// Task containing the result of the operation: true if the reader was successfully advanced | ||
/// to the next element; false if the reader has passed the end of the sequence.</returns> | ||
Task<bool> MoveNext(CancellationToken cancellationToken); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the goal to make this non-source breaking? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my source got broken here, would it make sence to do something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, there's an extension method that provides the parameterless MoveNext(): you need to make sure that extension is visible from your code and you should be fine. ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jtattermusch thanks for your answer, i'm using v 2.23. |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/2015/2019