Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <memory>
#include <typeinfo>
#include <vector>
using int_vector = std::vector<int>;
using int_vector_ptr = std::shared_ptr<int_vector>;
void foo(int_vector_ptr v)
{
trait Builder {
// I want this trait to return a trait object
fn commits(&self) -> Box<dyn Commit>;
fn finish(&self);
}
trait Commit {
}
# Libbitcoin Server configuration file
[log]
# The debug log file path, defaults to 'debug.log'.
debug_file = debug.log
# The error log file path, defaults to 'error.log'.
error_file = error.log
# The log archive directory, defaults to 'archive'.
archive_directory = archive
# The size at which a log is archived, defaults to 10000000 (0 disables).
struct network
{
};
struct handshake
{
handshake(network& net)
: net(net)
{
}
struct Network {
}
struct Handshake<'a> {
net: &'a Network
}
struct Foo<'a> {
net: Network,
hs: Handshake<'a>
#![feature(pin, arbitrary_self_types, optin_builtin_traits)]
use std::ptr;
use std::mem::Pin;
use std::boxed::PinBox;
use std::marker::Unpin;
struct SelfReferential {
data: i32,
self_ref: *const i32,
use std::net::TcpStream;
use futures::io;
use futures::prelude::*;
use smol::{Async, Timer};
use std::time::Duration;
async fn sleep(seconds: u64) {
Timer::after(Duration::from_secs(seconds)).await;
}
use futures::io;
use smol::{Async, Task, Timer};
use std::net::{TcpListener, TcpStream};
use std::thread;
use std::time::Duration;
async fn echo(stream: Async<TcpStream>) -> io::Result<()> {
Timer::after(Duration::from_secs(5)).await;
println!("sleep over");
io::copy(&stream, &mut &stream).await?;
struct Special
{
}
trait Trait
{
fn foo(&self);
}
impl<T> Trait for T
struct TitanClient {
}
impl TitanClient {
fn new() -> Self {
TitanClient {
}
}
fn stop(&self) {