This could probably be pretty easily done by taking code from rust-lightning-bitcoinrpc: https://github.com/TheBlueMatt/rust-lightning-bitcoinrpc/blob/master/src/main.rs#L247