jadewang has quit [Remote host closed the connection]
gopar has quit [Quit: Leaving]
kentonv has quit [Quit: Leaving]
jadewang has joined #sandstorm
jadewang has quit [Ping timeout: 240 seconds]
kentonv has joined #sandstorm
xcombelle has joined #sandstorm
jadewang has joined #sandstorm
jadewang has quit [Ping timeout: 244 seconds]
sasattack-deskto has quit [Ping timeout: 250 seconds]
sasattack-deskto has joined #sandstorm
sasattack-deskto has quit [Ping timeout: 250 seconds]
sasattack-deskto has joined #sandstorm
JWK has joined #sandstorm
<JWK>
Hello all
jadewang has joined #sandstorm
jadewang has quit [Ping timeout: 256 seconds]
JWK has quit [Quit: JWK]
JWK has joined #sandstorm
mrshu has joined #sandstorm
<dwrensha>
hello JWK
<JWK>
hi :-)
<dwrensha>
you have a capnproto-rust question for me?
<JWK>
yup
<dwrensha>
fire away
<JWK>
I had a question regarding as_reader() method in capnp-rust Builder struct. I was wondering if changing it to accept reference to self instead of value would break anything.
<dwrensha>
You would at least need to make sure to tie the lifetime of the input to the output, like this: `fn as_reader<'b>(&'b self) -> Builder<'b>`
<dwrensha>
er, `fn as_reader<'b>(&'b self) -> Reader<'b>`
<dwrensha>
otherwise you'll have potential aliasing issues
<JWK>
of course
<dwrensha>
and then the problem is exactly the same with taking a reference in a get() or an init() method: it's less flexible
<dwrensha>
it prevents you from returning calling `as_reader()` on something you've constructed in the middle of a function, and then returning the resulting reader
<dwrensha>
because it won't live long enough
<JWK>
the current problem I have with Builder structs is that I can only use it to write data into it, but not use it as internal struct for my application, because any simple read-only access to its contents move it. So if I have a capnp struct containing an integer, any attempt to read the integer will invalidate the struct.
<dwrensha>
that is what the borrow() method is for
<JWK>
yep, but borrow uses mutable self reference on input. It would be useful to have a read-only borrow that returned a Reader
<JWK>
for instance, if I wanted to implement fmt::Display for a Builder, right now I have no option.
<dwrensha>
hm, yeah I suppose that is awkward
<dwrensha>
could you impl Display for `&'a mut Builder<'a>`?
<JWK>
nop, that’s not possible, as the only method allowed for Display is: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result
<dwrensha>
it's also true the the core capnproto-rust library ought to be providing stringification functions...
<JWK>
Also, it would be nice to have as_reader(), borrow(), etc as traits, so they could be used in generics.
<dwrensha>
I think it should be possible to do `impl <'a> Display for `&'a mut Builder<'a> { ... }`. Then the self argument to `fmt()` would have type `& &mut Builder`.
<dwrensha>
Good point re generics. Yes, those should be provided via traits.
<dwrensha>
The "mut" that we end up needing for capnproto Builder types is more about uniqueness than about mutability per se.
<JWK>
I just tried your advice on Display, but it seems that, although the signature is respected, I cannot actually call borrow() or as_reader() on self:
<dwrensha>
I wonder whether we should provide two `as_reader()` methods for Builders. One by-move, and one by-reference.
<JWK>
error: cannot move out of borrowed content on as_reader(); cannot borrow data mutably in a `&` reference on borrow()
<JWK>
if it doesn’t break guarantees, it would be certainly helpful to support immutable patterns
<dwrensha>
... maybe the as-reference once would be called `borrow_as_reader()`
* JWK
nods
jadewang has joined #sandstorm
mnutt_ has joined #sandstorm
jadewang has quit [Ping timeout: 255 seconds]
<dwrensha>
OK, I'm pretty convinced that we need borrow_as_reader()
<dwrensha>
adding it now
<JWK>
:-)
<dwrensha>
hm... actually I'm first trying to convince myself that the impl Display that I suggested above doesn't work
synth has joined #sandstorm
<dwrensha>
OK, done.
<dwrensha>
JWK: do you need me to publish a new version on crates.io with this change?
<JWK>
well, that would be great, but I can just pull from github if you prefer to publish the new release later on.
<dwrensha>
OK, I'm going to hold off on publishing right this moment
<JWK>
thanks for your patience :-)
mnutt_ has quit [Quit: mnutt_]
jadewang has joined #sandstorm
jadewang has quit [Ping timeout: 244 seconds]
JWK has quit [Quit: JWK]
mnutt_ has joined #sandstorm
jadewang has joined #sandstorm
jadewang has quit [Ping timeout: 260 seconds]
mnutt_ has quit [Quit: mnutt_]
gopar has joined #sandstorm
xcombelle has quit [Remote host closed the connection]
neynah has joined #sandstorm
jadewang has joined #sandstorm
jadewang has quit [Ping timeout: 244 seconds]
synth has quit [Ping timeout: 246 seconds]
jadewang has joined #sandstorm
mnutt_ has joined #sandstorm
gopar has quit [Remote host closed the connection]
<mnutt_>
I’m trying to add HTTP methods to sandstorm’s WebSession and getting `remote exception: Method not implemented.; interfaceName = sandstorm/web-session.capnp:WebSession; typeId = 11891492725577853134; methodId = 10`. I’ve implemented the method in sandstorm-http-bridge.c++, is there something else I need to do to override properly?
<kentonv>
mnutt_: what app are you testing against?
<kentonv>
note that sandstorm-http-bridge is bundled into the app, so you'll have to rebuild the app
<mnutt_>
I’m using `make && make update` from the readme to rebuild sandstorm
<kentonv>
and the app?
<dwrensha>
mnutt_: by the way, you may find `make continuous` to be more convenient
JWK has quit [Quit: JWK]
<kentonv>
yeah, you can have `make continuous` running in one window and then do other `make` commands in another window and they'll avoid rebuilding from scratch every time
<mnutt_>
unfortunately the app depends on the changes so I’m building both at the same time, the app is here: https://github.com/mnutt/davros
<mnutt_>
I’m using spk while building the app
<kentonv>
ok, so after every `make update`, you'll need to kill `spk dev` and re-run it so it gets the latest sandstorm-http-bridge
<mnutt_>
ah, that would explain it. which is why sandstorm itself knows about the capnp changes but the app’s bridge doesn’t
<kentonv>
yeah
<kentonv>
TBH I'm surprised spk dev apps survive through sandstorm updates at all...
JWK has joined #sandstorm
<kentonv>
(shutting down for a bit to rewire my desk)
kentonv has quit [Quit: Leaving]
isd has joined #sandstorm
dwrensha has quit [Remote host closed the connection]