<FromGitter>
<ttdonovan> How are you planning to transmit IO? I tried looking at gRPC and the Ruby gem but it was way over my abilities to port and bind the C libraries.
<jeromegn>
@ttdonovan thanks :) I’ve mostly built it to write a Mesos framework, which prefers protobuf for communication. It’s through HTTP, so I just convert the io to a string and send it with the correct headers
<jeromegn>
the include allows to create structs and classes, the former is much more efficient :D
<jeromegn>
there is some logic that checks for recursive structs and will use a class in that case.
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<FromGitter>
<ttdonovan> OK, thanks - sounds like HTTP is the best option right now.
<FromGitter>
<ttdonovan> I'm really enjoying Crystal and am looking for opportunities to create micro-services and roll into my companies current stack.
perks has joined #crystal-lang
<RX14>
jeromegn, can you please use Benchmark.ips for your benchmarks
<RX14>
it's much much more readable and a more useful statistic
<jeromegn>
I probably can yes.
<jeromegn>
going to look it up
<RX14>
just do a run for each of creation encoding and ecoding
<RX14>
wish you could import ruby Benchmark.ips results into crystal
aldum has left #crystal-lang [#crystal-lang]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 240 seconds]
<jeromegn>
how do I convert a LibC::Char** to an array of string?
tomchapin has joined #crystal-lang
<pabs>
jeromegn: if it's the string you're pointing at is null-terminated, wouldn't String.new(ptr.value.as(Pointer(UInt8))) do what you want?
<pabs>
(where ptr is the LibC::Char** you're referring to)
<jeromegn>
right hmm
<jeromegn>
I can get the first value out like that yes
<pabs>
it's an array of strings?
<pabs>
oh, i see, array of strings
<jeromegn>
pretty sure :D haha. it’s a struct with a “count” and “data”, the count is an Int32 and data is LibC::Char**. that struct is named StringVector :)
<jeromegn>
doing it once, I get the right value for the first item, but I know there are 2 items in there
<jeromegn>
I’m basically writing the bindings for the zookeeper client
<jeromegn>
too lazy to make a native one
<pabs>
something like r = [] of String; count.times { |i| r << String.new((ptr + i).value.as(Pointer(UInt8)) } # (untested)
<jeromegn>
oh
<jeromegn>
that may make sense, going to give it a shot
<pabs>
ok
<jeromegn>
pabs: success!
<pabs>
alright!
<jeromegn>
TIL you can add to a pointer...
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 250 seconds]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
perks has quit [Quit: perks]
Dreamer3 has quit [Quit: Computer has gone to sleep.]