Skip to content

Instantly share code, notes, and snippets.

View matklad's full-sized avatar

Alex Kladov matklad

View GitHub Profile
-> % RUST_LOG=debug $CA metadata --verbose ~/projects/tokio
DEBUG:cargo::core::workspace: find_root - trying /home/matklad/projects/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /home/matklad/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /home/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /Cargo.toml
DEBUG:cargo::core::workspace: find_members - only me as a member
DEBUG:cargo::core::registry: load/missing file:///home/matklad/projects/tokio
DEBUG:cargo::sources::config: loading: file:///home/matklad/projects/tokio
DEBUG:cargo::core::resolver: initial activation: tokio v0.1.0 (file:///home/matklad/projects/tokio)
DEBUG:cargo::core::registry: load/missing https://github.com/carllerche/mio?branch=dev#c7b85ac7
@matklad
matklad / RustAnonParams.xml
Created August 10, 2016 18:09
Anonymous parameters usages across crates.io crates
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>file://$PROJECT_DIR$/atpp-1.6.7/src/atpp.rs</file>
<line>133</line>
<module>sources</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/atpp-1.6.7/src/atpp.rs" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Anonymous parameters</problem_class>
<description>Anonymous trait method parameter</description>
</problem>
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>file://$PROJECT_DIR$/components/gfx/font.rs</file>
<line>56</line>
<module>servo</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/components/gfx/font.rs" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Anonymous parameters</problem_class>
<description>Anonymous trait method parameter</description>
</problem>
@matklad
matklad / abandon_all_the_things.rs
Last active June 21, 2016 08:20
A "let it crash" style REPL skeleton in Rust
use std::thread;
use std::io::prelude::*;
/// This is an attempt to write a REPL application in
/// Erlangish "let it crash" style.
///
/// References:
/// - http://ferd.ca/the-zen-of-erlang.html
/// - http://joeduffyblog.com/2016/02/07/the-error-model/
///
@matklad
matklad / quest.txt
Last active December 18, 2015 18:40
matklad@nixos [09:31:33] [~/quest]
-> % cat g.c
int a;
int b;
int inc_a() { return a++; }
int inc_b() { return b++; }
int main() {
inc_a();
class MetaSpam(type):
def __new__(cls, name, bases, ns, *, metaarg=92):
print("new", metaarg)
return super().__new__(cls, name, bases, ns)
def __init__(self, name, bases, ns, *, metaarg=92):
print("init", metaarg)
super().__init__(name, bases, ns)
class A(metaclass=MetaSpam, metaarg="WUT?"):
pub mod references {
pub mod psi_ref {
// Unit like struct, the type with only one member
pub struct Ref;
impl Ref {
pub fn resolve(&self) -> &Ref {
// resolve is not pub, but we can use anything from the parent module's scope
super::resolve::do_resolve(self)
Can I use namedtuple?
| YES
|------------------------- Use namedtuple
| |Only two/three fields, forever?
| |---------------------------------- Consider tuples
|
|
|
|
|--Do I need order?
@matklad
matklad / execv.rs
Last active September 30, 2015 10:12
mod ffi {
use libc::{c_int, c_char};
extern {
pub fn setns(fd: c_int, nstype: c_int) -> c_int;
pub fn execvp(path: *const c_char, arg: *const *const c_char) -> c_int;
}
}