layer1capital / easy-jsonrpc

Rust crate for generating jsonrpc apis from trait definitions
Apache License 2.0
5 stars 4 forks source link

Consider allowing mutable owned args #2

Open bddap opened 5 years ago

bddap commented 5 years ago

We currently don't differentiate mutable reference args from mutable owned args. Mutable reference args should definitely be disallowed because mutable out parameters are a footgun in an rpc context.

Mutable owned args on the other hand, may be safe to allow. Consider the implications and allow if helpful. If not helpful, disallow; throw a different error message depending of whether the mutable parameter is owned or a reference.

casey commented 5 years ago

If an owned value isn't mutable, it can be rebound as mutable, so it might not be super useful to support. I haven't thought about it a ton, so of course there might be a reason to allow it that I haven't considered.

bddap commented 5 years ago

Since we aren't actually protecting the user from anything, allowing owned arguments would be a nice.