www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23724] New: HTTP.onReceive example does not compile

https://issues.dlang.org/show_bug.cgi?id=23724

          Issue ID: 23724
           Summary: HTTP.onReceive example does not compile
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

The following example from the documentation of std.net.curl.HTTP.onReceive
does not compile:

---
import std.net.curl, std.stdio;
auto client = HTTP("dlang.org");
client.onReceive = (ubyte[] data)
{
    writeln("Got data", to!(const(char)[])(data));
    return data.length;
};
client.perform();
---

The error message is:

---
Error: template instance `to!(const(char)[])` template `to` is not defined
---

--
Feb 17 2023