Re: Docs generation example
On Saturday, 10 October 2020 at 02:07:02 UTC, Виталий Фадеев wrote: Wanted! Docs generation example. I have dub project, sources/*.d. I want html-index with all classes/functions. Is exists simple, hi-level, one-line command line solution ? dub run adrdox -- -i sources Files will be in generated-docs/
Docs generation example
Wanted! Docs generation example. I have dub project, sources/*.d. I want html-index with all classes/functions. Is exists simple, hi-level, one-line command line solution ?
How do I use translation module in vibe.d?
Documentation[1] tells to use @translationModule!TranslationContext on class, like this: @translationModule!TranslationContext class WebInterface { ... but it return the error: Error: template instance translationModule!(TranslationContext) does not match template declaration translationModule(string FILENAME) it seems that construtor was removed[2] but I can't find the replacement anywhere. Could someone help with that? [1]: see "location" section: https://vibed.org/docs#Localization [2]: https://vibed.org/api/search?q=translationModule
Re: Is there a way to force emitting of stack frame for a specific function?
On Friday, 9 October 2020 at 02:01:30 UTC, Andrey Zherikov wrote: The question: is it possible to tell compiler to always generate stack frame for my stackFrame function? "pragma(inline, false)" doesn't help here - the result is completely the same. (Do you mean a stack frame, or a frame pointer?) If you use LDC, you can specify --frame-pointer=all. bin/ldc2 --help | grep "frame" --frame-pointer= - Specify frame pointer elimination optimization =all- Disable frame pointer elimination =non-leaf - Disable frame pointer elimination for non-leaf frame =none - Enable frame pointer elimination cheers, Johan
Re: std.net.curl get json_encode
On Friday, 9 October 2020 at 05:56:05 UTC, Vino wrote: On Friday, 9 October 2020 at 05:30:34 UTC, ikod wrote: On Friday, 9 October 2020 at 01:45:37 UTC, Vino wrote: On Friday, 2 October 2020 at 23:20:48 UTC, Imperatorn wrote: On Friday, 2 October 2020 at 21:12:09 UTC, Vino wrote: Hi All, ... auto content = https.perform(); https.shutdown; JSONValue jv = parseJSONValue(content); Maybe JSONValue jv = toJSONValue(content); writeln(jv["Name"]); } From, Vino Hi Ikod, No luck. Error test.d(19): Error: template `stdx.data.json.parser.toJSONValue` cannot deduce function from argument types `!()(int)`, candidates are: C:\D\dmd2\windows\bin\..\..\src\phobos\stdx\data\json\parser.d(58): `toJSONValue(LexOptions options = LexOptions.init, Input)(Input input, string filename = "", int maxDepth = defaultMaxDepth)` with `options = cast(LexOptions)0, Input = int` whose parameters have the following constraints: `` ` > isInputRange!Input - isSomeChar!(ElementType!Input) or: - isIntegral!(ElementType!Input) ` `` C:\D\dmd2\windows\bin\..\..\src\phobos\stdx\data\json\parser.d(65): `toJSONValue(Input)(Input tokens, int maxDepth = defaultMaxDepth)` with `Input = int` whose parameters have the following constraints: `` ` > isJSONTokenInputRange!Input ` `` datacoll.d(19):All possible candidates are marked as `deprecated` or `@disable` Tip: not satisfied constraints are marked with `>` From, Vino (Writing from my mobile, a lot of room for improvements): import std.net.curl, std.stdio; // GET with custom data receivers auto http = HTTP("dlang.org"); http.onReceiveHeader = (in char[] key, in char[] value) { writeln(key, ": ", value); }; ubyte[] content; http.onReceive = (ubyte[] data) { content ~= data; return data.length; }; http.perform(); string s = cast(string) content; Kind regards Andre
Re: How auto convert Variant to required function arguments?
On Friday, 9 October 2020 at 16:10:03 UTC, Ferhat Kurtulmuş wrote: On Friday, 9 October 2020 at 15:49:31 UTC, Ferhat Kurtulmuş wrote: On Friday, 9 October 2020 at 00:19:20 UTC, Marcone wrote: How auto convert Variant to required function arguments? import std.variant; import std.stdio; Variant a; int mul2(Variant b){ int c = *b.peek!(int); return 2*c; } int mul3(int b){ return 3*b; } void main() { a = 5; writeln(mul2(a)); Variant b = 3; writeln(mul3(*b.peek!int)); } Uh, probably this is not what you want. I found this thread: https://forum.dlang.org/thread/ebylgcrslkelgrvnt...@forum.dlang.org You man need to use Algebraic. may*
Re: How auto convert Variant to required function arguments?
On Friday, 9 October 2020 at 15:49:31 UTC, Ferhat Kurtulmuş wrote: On Friday, 9 October 2020 at 00:19:20 UTC, Marcone wrote: How auto convert Variant to required function arguments? import std.variant; import std.stdio; Variant a; int mul2(Variant b){ int c = *b.peek!(int); return 2*c; } int mul3(int b){ return 3*b; } void main() { a = 5; writeln(mul2(a)); Variant b = 3; writeln(mul3(*b.peek!int)); } Uh, probably this is not what you want. I found this thread: https://forum.dlang.org/thread/ebylgcrslkelgrvnt...@forum.dlang.org You man need to use Algebraic.
Re: How auto convert Variant to required function arguments?
On Friday, 9 October 2020 at 00:19:20 UTC, Marcone wrote: How auto convert Variant to required function arguments? import std.variant; import std.stdio; Variant a; int mul2(Variant b){ int c = *b.peek!(int); return 2*c; } int mul3(int b){ return 3*b; } void main() { a = 5; writeln(mul2(a)); Variant b = 3; writeln(mul3(*b.peek!int)); }