Skip to content

Commit

Permalink
Fix width of code samples
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier committed Sep 13, 2023
1 parent cd96dad commit efb0c5c
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 47 deletions.
8 changes: 4 additions & 4 deletions src/IceRpc.Compressor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface Greeter {
```

```csharp
// Client application
// Client application (C#)
using IceRpc;
using VisitorCenter;
Expand All @@ -47,7 +47,7 @@ string greeting = await greeterProxy.GreetAsync(Environment.UserName);
```

```csharp
// Server application
// Server application (C#)
using IceRpc;
using IceRpc.Slice;
Expand Down Expand Up @@ -78,7 +78,7 @@ interface Greeter {
```

```csharp
// Client application
// Client application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand All @@ -102,7 +102,7 @@ host.Run();
```

```csharp
// Server application
// Server application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand Down
8 changes: 4 additions & 4 deletions src/IceRpc.Deadline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fields received with incoming requests.
## Sample code

```csharp
// Client application
// Client application (C#)
using IceRpc;

Expand All @@ -23,7 +23,7 @@ Pipeline pipeline = new Pipeline()
```

```csharp
// Server application
// Server application (C#)
using IceRpc;

Expand All @@ -39,7 +39,7 @@ server.Listen();
## Sample code with DI

```csharp
// Client application
// Client application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand All @@ -60,7 +60,7 @@ host.Run();
```

```csharp
// Server application
// Server application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand Down
4 changes: 2 additions & 2 deletions src/IceRpc.Extensions.DependencyInjection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ IceRpc.Extensions.DependencyInjection helps you build applications with [IceRPC]
## Sample code

```csharp
// Client application
// Client application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand All @@ -32,7 +32,7 @@ host.Run();
```

```csharp
// Server application
// Server application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand Down
3 changes: 2 additions & 1 deletion src/IceRpc.Locator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ pipeline = pipeline
.UseLocator(locatorProxy)
.Into(connectionCache);

// A call on this proxy will use the locator to find the server address(es) associated with `/hello`.
// A call on this proxy will use the locator to find the server address(es) associated with
// `/hello`.
// The locator interceptor caches successful resolutions.
var wellKnownProxy = new HelloProxy(pipeline, new Uri("ice:/hello"));

Expand Down
8 changes: 4 additions & 4 deletions src/IceRpc.Logger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ logs every dispatch.
## Sample code

```csharp
// Client application
// Client application (C#)
using Microsoft.Extensions.Logging;
using IceRpc;
Expand All @@ -29,7 +29,7 @@ Pipeline pipeline = new Pipeline()
```

```csharp
// Server application
// Server application (C#)
using Microsoft.Extensions.Logging;
using IceRpc;
Expand All @@ -50,7 +50,7 @@ Router router = new Router()
## Sample code with DI

```csharp
// Client application
// Client application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand All @@ -71,7 +71,7 @@ host.Run();
```

```csharp
// Server application
// Server application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand Down
8 changes: 4 additions & 4 deletions src/IceRpc.Metrics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ You can display the collected measurements with [dotnet-counters][dotnet_counter
## Sample code

```csharp
// Client application
// Client application (C#)
using IceRpc;

Expand All @@ -23,7 +23,7 @@ Pipeline pipeline = new Pipeline().UseMetrics().Into(connection);
```

```csharp
// Server application
// Server application (C#)
using IceRpc;

Expand All @@ -34,7 +34,7 @@ Router router = new Router().UseMetrics().Map<...>(...);
## Sample code with DI

```csharp
// Client application
// Client application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand All @@ -55,7 +55,7 @@ host.Run();
```

```csharp
// Server application
// Server application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand Down
8 changes: 4 additions & 4 deletions src/IceRpc.RequestContext/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ features.
## Sample code

```csharp
// Client application
// Client application (C#)
using IceRpc;

Expand All @@ -22,7 +22,7 @@ Pipeline pipeline = new Pipeline()
```

```csharp
// Server application
// Server application (C#)
using IceRpc;

Expand All @@ -38,7 +38,7 @@ server.Listen();
## Sample code with DI

```csharp
// Client application
// Client application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand All @@ -59,7 +59,7 @@ host.Run();
```

```csharp
// Server application
// Server application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand Down
4 changes: 2 additions & 2 deletions src/IceRpc.Retry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ IceRpc.Retry provides an [IceRPC][icerpc-csharp] interceptor that retries failed
## Sample code

```csharp
// Client application
// Client application (C#)
using IceRpc;

Expand All @@ -22,7 +22,7 @@ Pipeline pipeline = new Pipeline()
## Sample code with DI

```csharp
// Client application
// Client application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand Down
8 changes: 4 additions & 4 deletions src/IceRpc.Slice/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface Greeter {
```

```csharp
// Client application
// Client application (C#)
using IceRpc;
using VisitorCenter;
Expand All @@ -41,7 +41,7 @@ await connection.ShutdownAsync();
```

```csharp
// Server application
// Server application (C#)
using IceRpc;
using IceRpc.Features;
Expand All @@ -55,8 +55,8 @@ server.Listen();
await CancelKeyPressed;
await server.ShutdownAsync();

// Class IceRpc.Slice.Service is an IceRPC dispatcher. This dispatch is implemented by Chatbot and helper code provided
// by the IGreeterService interface generated by the Slice compiler.
// Class IceRpc.Slice.Service is an IceRPC dispatcher. This dispatch is implemented by Chatbot and
// helper code provided by the IGreeterService interface generated by the Slice compiler.
internal class Chatbot : Service, IGreeterService
{
public ValueTask<string> GreetAsync(
Expand Down
8 changes: 4 additions & 4 deletions src/IceRpc.Telemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ middleware restores the activity context and uses it to set the parent activity
## Sample code

```csharp
// Client application
// Client application (C#)
using IceRpc;

Expand All @@ -26,7 +26,7 @@ Pipeline pipeline = new Pipeline().UseTelemetry(activitySource).Into(connection)
```

```csharp
// Server application
// Server application (C#)
using IceRpc;
using VisitorCenter;
Expand All @@ -41,7 +41,7 @@ Router router = new Router().UseTelemetry(activitySource);
## Sample code with DI

```csharp
// Client application
// Client application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand All @@ -64,7 +64,7 @@ host.Run();
```

```csharp
// Server application
// Server application (C#)
using IceRpc;
using IceRpc.Extensions.DependencyInjection;
Expand Down
4 changes: 2 additions & 2 deletions src/IceRpc.Templates/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Templates for IceRPC

[Source code][source] | [Package][package]

IceRpc.Templates provides `dotnet new` project templates for [IceRPC][icerpc]. The following templates are included:

| Template Name | Description |
Expand Down Expand Up @@ -35,8 +37,6 @@ dotnet build
dotnet run
```

[Source code][source] | [Package][package]

[icerpc]: https://www.nuget.org/packages/IceRpc
[package]: https://www.nuget.org/packages/IceRpc.Templates
[source]: https://github.com/icerpc/icerpc-csharp/tree/main/src/IceRpc.Templates
4 changes: 2 additions & 2 deletions src/IceRpc.Transports.Coloc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This transport does not use network APIs. It is available on all platforms.
## Sample code

```csharp
// Create an IceRPC server with Coloc
// Create an IceRPC server with Coloc (C#)
using IceRpc;
using IceRpc.Transports.Coloc;
Expand All @@ -26,7 +26,7 @@ await using var server = new Server(

server.Listen();

// Create a client connection to this server
// Create a client connection to this server (C#)
await using var connection = new ClientConnection(
new Uri("icerpc://host"), // you can use any host and port with coloc
Expand Down
4 changes: 2 additions & 2 deletions src/IceRpc.Transports.Quic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ QUIC is a new UDP-based multiplexed transport used by HTTP/3 and several other a
## Sample code

```csharp
// Create an IceRPC client connection with QUIC
// Create an IceRPC client connection with QUIC (C#)
using IceRpc;
using IceRpc.Transports.Quic;
Expand All @@ -23,7 +23,7 @@ await using var connection = new ClientConnection(
```

```csharp
// Create an IceRPC server with QUIC
// Create an IceRPC server with QUIC (C#)
using IceRpc;
using IceRpc.Transports.Quic;
Expand Down
17 changes: 11 additions & 6 deletions src/IceRpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and package represent the base assembly and package for the [C# implementation o
## Sample Code

```csharp
// Client application
// Client application (C#)
using GreeterCore; // for the StringCodec helper class
using IceRpc;
Expand All @@ -30,8 +30,8 @@ async Task<string> GreetAsync(string name)
Payload = StringCodec.EncodeString(name)
};

// Make the invocation: we send the request using the client connection and then wait for the response. Since the
// client connection is not connected yet, this call also connects it.
// Make the invocation: we send the request using the client connection and then wait for the
// response. Since the client connection is not connected yet, this call also connects it.
IncomingResponse response = await connection.InvokeAsync(request);

// When the response's status code is Ok, we decode its payload.
Expand All @@ -48,7 +48,7 @@ async Task<string> GreetAsync(string name)
```

```csharp
// Server application
// Server application (C#)
using GreeterCore; // for the StringCodec helper class
using IceRpc;
Expand All @@ -63,14 +63,19 @@ await server.ShutdownAsync();

internal class Chatbot : IDispatcher
{
public async ValueTask<OutgoingResponse> DispatchAsync(IncomingRequest request, CancellationToken cancellationToken)
public async ValueTask<OutgoingResponse> DispatchAsync(
IncomingRequest request,
CancellationToken cancellationToken)
{
if (request.Operation == "greet")
{
string name = await StringCodec.DecodePayloadStringAsync(request.Payload);
Console.WriteLine($"Dispatching greet request {{ name = '{name}' }}");

return new OutgoingResponse(request) { Payload = StringCodec.EncodeString($"Hello, {name}!") };
return new OutgoingResponse(request)
{
Payload = StringCodec.EncodeString($"Hello, {name}!")
};
}
else
{
Expand Down
Loading

0 comments on commit efb0c5c

Please sign in to comment.