Add generic variance to reader and writer interfaces

pull/20549/head
James Newton-King 6 years ago
parent 1ecded0629
commit 4086431c1d
No known key found for this signature in database
GPG Key ID: A66B2F456BF5526
  1. 2
      src/csharp/Grpc.Core.Api/IAsyncStreamReader.cs
  2. 4
      src/csharp/Grpc.Core.Api/IAsyncStreamWriter.cs
  3. 4
      src/csharp/Grpc.Core.Api/IClientStreamWriter.cs
  4. 4
      src/csharp/Grpc.Core.Api/IServerStreamWriter.cs

@ -47,7 +47,7 @@ namespace Grpc.Core
/// </para> /// </para>
/// </summary> /// </summary>
/// <typeparam name="T">The message type.</typeparam> /// <typeparam name="T">The message type.</typeparam>
public interface IAsyncStreamReader<T> public interface IAsyncStreamReader<out T>
{ {
/// <summary> /// <summary>
/// Gets the current element in the iteration. /// Gets the current element in the iteration.

@ -1,4 +1,4 @@
#region Copyright notice and license #region Copyright notice and license
// Copyright 2015 gRPC authors. // Copyright 2015 gRPC authors.
// //
@ -28,7 +28,7 @@ namespace Grpc.Core
/// A writable stream of messages. /// A writable stream of messages.
/// </summary> /// </summary>
/// <typeparam name="T">The message type.</typeparam> /// <typeparam name="T">The message type.</typeparam>
public interface IAsyncStreamWriter<T> public interface IAsyncStreamWriter<in T>
{ {
/// <summary> /// <summary>
/// Writes a single asynchronously. Only one write can be pending at a time. /// Writes a single asynchronously. Only one write can be pending at a time.

@ -1,4 +1,4 @@
#region Copyright notice and license #region Copyright notice and license
// Copyright 2015 gRPC authors. // Copyright 2015 gRPC authors.
// //
@ -28,7 +28,7 @@ namespace Grpc.Core
/// Client-side writable stream of messages with Close capability. /// Client-side writable stream of messages with Close capability.
/// </summary> /// </summary>
/// <typeparam name="T">The message type.</typeparam> /// <typeparam name="T">The message type.</typeparam>
public interface IClientStreamWriter<T> : IAsyncStreamWriter<T> public interface IClientStreamWriter<in T> : IAsyncStreamWriter<T>
{ {
/// <summary> /// <summary>
/// Completes/closes the stream. Can only be called once there is no pending write. No writes should follow calling this. /// Completes/closes the stream. Can only be called once there is no pending write. No writes should follow calling this.

@ -1,4 +1,4 @@
#region Copyright notice and license #region Copyright notice and license
// Copyright 2015 gRPC authors. // Copyright 2015 gRPC authors.
// //
@ -27,7 +27,7 @@ namespace Grpc.Core
/// <summary> /// <summary>
/// A writable stream of messages that is used in server-side handlers. /// A writable stream of messages that is used in server-side handlers.
/// </summary> /// </summary>
public interface IServerStreamWriter<T> : IAsyncStreamWriter<T> public interface IServerStreamWriter<in T> : IAsyncStreamWriter<T>
{ {
// TODO(jtattermusch): consider just using IAsyncStreamWriter instead of this interface. // TODO(jtattermusch): consider just using IAsyncStreamWriter instead of this interface.
} }

Loading…
Cancel
Save