hunt library 1.0.0 released!

Brian zoujiaqing at gmail.com
Tue Jan 15 14:58:01 UTC 2019


A refined core library for D programming language.

Core modules:

     hunt.concurrency
     hunt.collection
     hunt.event
     hunt.io
     hunt.logging
     hunt.text
     hunt.util

Supported platforms:

     FreeBSD
     Windows
     macOS
     Linux

Example for hunt.io echo server:

```D
void main()
{
     auto loop = new EventLoop();
     auto listener = new TcpListener(loop, AddressFamily.INET, 
512);

     
listener.bind(8080).listen(1024).onConnectionAccepted((TcpListener sender, TcpStream client) {

         client.onDataReceived((in ubyte[] data) {
             const(ubyte)[] sentData = data;
             client.write(sentData, (in ubyte[] wdata, size_t 
nBytes) {
                 debug writefln("thread: %s, sent bytes: %d", 
getTid(), nBytes);

                 if (sentData.length > nBytes)
                     writefln("remaining bytes: ", sentData.length 
- nBytes);
             });

         });
     }).start();

     writeln("Listening on: ", listener.bindingAddress.toString());
     loop.run();
}
```
sample code link: 
https://github.com/huntlabs/hunt/blob/master/examples/TcpDemo/source/server.d


Example for HashMap:
```D
void main()
{

         HashMap!(string, string) hm = new HashMap!(string, 
string)();

         //add key-value pair to hashmap
         hm.put("first", "FIRST INSERTED");
         hm.put("second", "SECOND INSERTED");
         hm.put("third","THIRD INSERTED");

         writeln(hm);
}
```


About for performance VS rust / golang you can look this pictrue, 
have benchmark result:
https://raw.githubusercontent.com/huntlabs/hunt/master/docs/images/benchmark.png

You can find more information in github repo:

https://github.com/huntlabs/hunt




More information about the Digitalmars-d-announce mailing list