This file contains hidden or 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
trait Builder { | |
// I want this trait to return a trait object | |
fn commits(&self) -> Box<dyn Commit>; | |
fn finish(&self); | |
} | |
trait Commit { | |
} |
This file contains hidden or 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
# 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). |
This file contains hidden or 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
struct network | |
{ | |
}; | |
struct handshake | |
{ | |
handshake(network& net) | |
: net(net) | |
{ | |
} |
This file contains hidden or 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
struct Network { | |
} | |
struct Handshake<'a> { | |
net: &'a Network | |
} | |
struct Foo<'a> { | |
net: Network, | |
hs: Handshake<'a> |
This file contains hidden or 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
#![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, |
This file contains hidden or 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
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; | |
} |
This file contains hidden or 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
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?; |
This file contains hidden or 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
struct Special | |
{ | |
} | |
trait Trait | |
{ | |
fn foo(&self); | |
} | |
impl<T> Trait for T |
This file contains hidden or 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
struct TitanClient { | |
} | |
impl TitanClient { | |
fn new() -> Self { | |
TitanClient { | |
} | |
} | |
fn stop(&self) { |