socketrange 0.1.1

Minimal range wrapper of socket


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

socketrange

Minimal range wrapper of socket for D.

Usage

import std.algorithm : equal;
import std.socket : socketPair;
import socketrange;

void main() {
  auto pair = socketPair();
  
  /// Wrap as OutputRange
  auto writer = SocketOutputRange(pair[0]);
  
  /// Wrap as InputRange of char
  auto reader = SocketInputRange!char(pair[1]);
  
  write.put("foobar");
  writer.close();
  
  assert(equal(reader, "foobar"));
}

struct SocketOutputRange

Wrap socket as OutputRange.

struct SocketInputRange(T)

Wrap socket as InputRange of T.

struct SocketRange(In, Out = In)

Wrap socket as Output/InputRange of In. Out can be void to put any types.

Authors:
  • ukatama
Dependencies:
none
Versions:
1.0.1 2016-Apr-18
1.0.0 2015-Dec-14
0.2.0 2015-Dec-03
0.1.1 2015-Dec-02
0.1.0 2015-Dec-02
Show all 6 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 111 downloads total

Score:
0.8
Short URL:
socketrange.dub.pm