Skip to content

Instantly share code, notes, and snippets.

View niklasad1's full-sized avatar

Niklas Adolfsson niklasad1

View GitHub Profile
@niklasad1
niklasad1 / rustc.err
Last active November 6, 2019 14:40
rustc.err
error[E0599]: no method named `size_of` found for type `lock_api::rwlock::RwLock<parking_lot::raw_rwlock::RawRwLock, std::collections::HashMap<primitive_types::H256, common_types::encoded::Header>>` in the current scope
--> ethcore/blockchain/src/blockchain.rs:1495:31
|
1495 | blocks: self.block_headers.size_of(&mut ops) + self.block_bodies.size_of(&mut ops),
| ^^^^^^^ method not found in `lock_api::rwlock::RwLock<parking_lot::raw_rwlock::RawRwLock, std::collections::HashMap<primitive_types::H256, common_types::encoded::Header>>`
error[E0599]: no method named `size_of` found for type `lock_api::rwlock::RwLock<parking_lot::raw_rwlock::RawRwLock, std::collections::HashMap<primitive_types::H256, common_types::encoded::Body>>` in the current scope
--> ethcore/blockchain/src/blockchain.rs:1495:69
|
1495 | blocks: self.block_headers.size_of(&mut ops) + self.block_bodies.size_of(&mut ops),
➜ rust-rocksdb git:(master) ✗ rustc --version
rustc 1.35.0-nightly (99da733f7 2019-04-12)
➜ rust-rocksdb git:(master) ✗ cargo build --verbose
Running `rustc --crate-name librocksdb_sys librocksdb-sys/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 --cfg 'feature="bzip2"' --cfg 'feature="default"' --cfg 'feature="lz4"' --cfg 'feature="snappy"' --cfg 'feature="static"' --cfg 'feature="zlib"' --cfg 'feature="zstd"' -C metadata=47b8de30a9ba6053 -C extra-filename=-47b8de30a9ba6053 --out-dir /home/niklasad1/Github/rust-rocksdb/target/debug/deps -C incremental=/home/niklasad1/Github/rust-rocksdb/target/debug/incremental -L dependency=/home/niklasad1/Github/rust-rocksdb/target/debug/deps --extern libc=/home/niklasad1/Github/rust-rocksdb/target/debug/deps/liblibc-c99638c9ab43e1d0.rlib -L native=/home/niklasad1/Github/rust-rocksdb/target/debug/build/librocksdb-sys-0c206f733d8a857b/out -L native=/home/niklasad1/Github/rust-rocksdb/target/debug/build/librocksdb-sys-0c206f733d8a857b/out -L
@niklasad1
niklasad1 / kovan_send_tx.log
Created March 21, 2019 15:16
Kovan log from submitting a transaction
sending transaction: 0xe41655e7791d94991440ae909c94102fc3a5aa81c00f5802fd4897d9f07f1c83
Ok(Some(Transaction { hash: 0xe41655e7791d94991440ae909c94102fc3a5aa81c00f5802fd4897d9f07f1c83, nonce: 2, block_hash: None, block_number: None, transaction_index: None, from: 0x510042dcbba1e1da98282562909d7fa49bf7cae4, to: Some(0x0000000000000000000000000000000000000000), value: 1337, gas_price: 1000000000, gas: 2666666, input: Bytes([1, 2, 3]) }))
Ok(Some(Transaction { hash: 0xe41655e7791d94991440ae909c94102fc3a5aa81c00f5802fd4897d9f07f1c83, nonce: 2, block_hash: None, block_number: None, transaction_index: None, from: 0x510042dcbba1e1da98282562909d7fa49bf7cae4, to: Some(0x0000000000000000000000000000000000000000), value: 1337, gas_price: 1000000000, gas: 2666666, input: Bytes([1, 2, 3]) }))
Ok(Some(Transaction { hash: 0xe41655e7791d94991440ae909c94102fc3a5aa81c00f5802fd4897d9f07f1c83, nonce: 2, block_hash: None, block_number: None, transaction_index: None, from: 0x510042dcbba1e1da98282562909d7fa49bf7cae4, to: Some(0x0000
@niklasad1
niklasad1 / rust.md
Created February 11, 2019 10:15
Rust, cargo commands

Expand macros

$ cargo rustc -- --pretty expanded -Z unstable-options

Emit asm

$ cargo rustc -- --emit asm && cat target/debug/deps/project_name-hash.s

Emit llvm-ir

$ cargo rustc -- --emit llvm-ir && cat target/debug/deps/project_name-hash.ll

Emit HIR

@niklasad1
niklasad1 / build.log
Created February 6, 2019 13:44
parity-android
root@3a35b9c63a3d:/usr/code# rustc --version
rustc 1.32.0 (9fda7c223 2019-01-16)
root@3a35b9c63a3d:/usr/code# cargo build --target armv7-linux-androideabi
Updating git repository `https://github.com/cheme/heapsize.git`
Updating crates.io index
Updating git repository `https://github.com/paritytech/rust-secp256k1`
Updating git repository `https://github.com/paritytech/app-dirs-rs`
Updating git repository `https://github.com/paritytech/bn`
Updating git repository `https://github.com/paritytech/jsonrpc.git`
Updating git repository `https://github.com/paritytech/hidapi-rs`
extern crate web3;
#[macro_use]
extern crate hex_literal;
use web3::futures::Future;
use web3::types::*;
fn main() {
read_only();
account();
@niklasad1
niklasad1 / init.vim
Last active December 16, 2018 09:37
nvim config
call plug#begin('~/.vim/plugged')
Plug 'editorconfig/editorconfig-vim'
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
Plug 'ncm2/ncm2-racer'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'scrooloose/nerdcommenter'
Plug 'Chiel92/vim-autoformat'
Plug 'vim-syntastic/syntastic'
Plug 'rust-lang/rust.vim'
@niklasad1
niklasad1 / nrf52.svd
Created April 15, 2018 12:10
nrf52.svd from `nRF5 SDK 15.0.0 a53641a`
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="utf-8"?>
<!-- File naming: <vendor>_<part/series name>_svd.xml -->
<device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" noNamespaceSchemaLocation="CMSIS-SVD.xsd">
<vendor>Nordic Semiconductor</vendor>
<vendorID>Nordic</vendorID>
<name>nrf52</name>
<series>nrf52</series>
<version>1</version>
<description>nRF52832 reference description for radio MCU with ARM 32-bit Cortex-M4 Microcontroller </description>
<licenseText>
@niklasad1
niklasad1 / state.rs
Created October 23, 2017 15:04
ooooo
// Imagine I have an immutable struct here that must have the same type
// but I want to have "compile-time" verified transitions between the states
// with a "state enum" that hold different types
#[derive(Debug)]
struct Foo {
state: Option<MyState>,
}
impl Foo {
@niklasad1
niklasad1 / Makefile
Last active October 12, 2017 10:50
Makefile skeleton
# Makefile skeleton
#
# $@ - The name of the target file (the one before the colon)
# $< - The name of the first (or only) prerequisite file (the first one after the colon)
# $^ - The names of all the prerequisite files (space separated)
# $* - The stem (the bit which matches the % wildcard in the rule definition.
CC = gcc
CFLAGS = -std=c99
CFLAGS += -Wall