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
let quit_send = self.quit_send.clone(); | |
io.add_method("quit", move |_| { | |
let quit_send = quit_send.clone(); | |
async move { | |
quit_send.send(()).await; | |
Ok(jsonrpc_core::Value::Null) | |
} | |
}); |
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
#lang racket | |
(define (create_local ident) | |
(printf "value: ~a\n" ident) | |
110 | |
) | |
(define (foo) ( | |
(let ([local (create_local 'x)]) | |
(displayln "hihi") |
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
error: cannot infer an appropriate lifetime | |
--> examples/client.rs:84:20 | |
| | |
84 | async fn start(&self) -> io::Result<()> { | |
| ^^^^^ ...but this borrow... | |
... | |
90 | let _ = smol::Task::spawn(self.wait_shutdown_signal(stopped.clone())); | |
| ----------------- this return type evaluates to the `'static` lifetime... | |
| | |
note: ...can't outlive the lifetime `'_` as defined on the method body at 84:20 |
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
impl<T: Send + 'static> Task<T> { | |
/// Spawns a future onto the work-stealing executor. | |
/// | |
/// This future may be stolen and polled by any thread calling [`run()`]. | |
/// | |
/// # Examples | |
/// | |
/// ``` | |
/// use smol::Task; | |
/// |
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) { |
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
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
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
#![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
struct Network { | |
} | |
struct Handshake<'a> { | |
net: &'a Network | |
} | |
struct Foo<'a> { | |
net: Network, | |
hs: Handshake<'a> |
NewerOlder