This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Simple HTTP proxy in Rust. Hard coded to proxy rust-lang.org. | |
*/ | |
extern crate hyper; | |
use std::io::Read; | |
use hyper::Client; | |
use hyper::header::Connection; |
Recentely, I was trying to make sure our README.md
files for DAO DAO
were included in the documentation generated by cargo doc
or rustdoc
. Moreover, I wanted code examples in our README.md
files to be tested.
Here's a quick gist...
There is of course the doc attribute,
and the rust book contains the following example which you are meant to include in your lib.rs
or main.rs
:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Long story short, IBC is not support with cw_multi_test, and I have a storage that is updaing based on some IBC call | |
// Because I can't mock the IBC call, I had to update the storage manually, heres a little helper to do so. | |
pub fn update_storage(app: &mut App, address: &[u8], function: &mut dyn FnMut(&mut PrefixedStorage)) { | |
app.init_modules(|_, _, storage| { | |
let mut namespace = b"contract_data/".to_vec(); | |
namespace.extend_from_slice(address); | |
let mut prefixed_storage = PrefixedStorage::multilevel(storage, &[b"wasm", &namespace]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"reflect" | |
"cosmossdk.io/simapp" | |
"github.com/cosmos/cosmos-sdk/codec" | |
codectypes "github.com/cosmos/cosmos-sdk/codec/types" |