This file contains 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
[package] | |
authors = ["Mika Attila <radiantstatue@gmail.com>"] | |
name = "plugintest" | |
version = "0.1.0" | |
[dependencies] | |
dylib = "0.0.2" | |
[lib] | |
name = "guest" |
This file contains 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
enum Option<T> { | |
None, | |
Some(T) | |
} | |
// desugars to | |
enum Option<T> { | |
None {..}, | |
Some {..} |
This file contains 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
// desugaring for await/async, see: https://gist.github.com/eddyb/822c658190ccf18058db | |
pub mod gen { | |
use std::marker::PhantomData; | |
#[cfg_attr(std, lang = "yield")] | |
pub enum Yield<T, R> { | |
Value(T), | |
Return(R) | |
} |
This file contains 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
mod owned { | |
#[lang="own_in"] | |
struct OwnIn<T: ?Sized, P: Place<T>> { | |
ptr: *mut T, | |
place: P | |
} | |
#[lang="place"] | |
trait Place<T: ?Sized> { | |
unsafe fn cleanup(self, ptr: *mut T) {} |
This file contains 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 async::fs::File; | |
use async::io::Async; | |
fn copy(src: &Path, dst: &Path) -> impl Async<()> { | |
let src = try!(File::open(src)); | |
let dst = try!(File::create(dst)); | |
// Copy a kiB at a time. | |
let mut buffer = Vec::with_capacity(1024); | |
loop { |
This file contains 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
// from crates.io | |
//extern crate mmap; | |
//extern crate libc; | |
//mod fpga_awg; | |
//fn main() { | |
// let mut awg = fpga_awg::fpgaAwg::new(); | |
// let mut params: fpga_awg::awgParam = fpga_awg::awgParam::default(); | |
//let mut data: [i32; fpga_awg::n] = [0; fpga_awg::n]; |
This file contains 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
// from crates.io | |
extern crate mmap; | |
extern crate libc; | |
mod fpga_awg; | |
use std::ptr; | |
use std::fs; | |
use std::io::{Write, SeekFrom, Seek}; | |
use std::os::unix::prelude::AsRawFd; |
This file contains 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
mod simple; | |
use simple::Expr::{Number, Add, Multiply}; | |
fn main() { | |
println!("Let's compute!"); | |
let e = Add(Box::new(Add(Box::new(Number(1)), | |
Box::new(Number(1)))), | |
Box::new(Multiply(Box::new(Number(2)), |
This file contains 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
.section __TEXT,__text,regular,pure_instructions | |
.align 4, 0x90 | |
__ZN4main20h84fd99f07df2d50ffaaE: | |
.cfi_startproc | |
.cfi_personality 155, _rust_eh_personality | |
Leh_func_begin0: | |
.cfi_lsda 16, Lexception0 | |
cmpq %gs:816, %rsp | |
ja LBB0_2 | |
movabsq $56, %r10 |
This file contains 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
rustc-host-x86_64-unknown-linux-gnu: libgraphviz | |
src/libgraphviz/lib.rs:373:16: 373:36 error: mismatched types: | |
expected `Option<Id<'a>>`, | |
found `Result<Id<'_>, _>` | |
(expected enum `Option`, | |
found enum `Result`) | |
src/libgraphviz/lib.rs:373 return Ok(Id{ name: name }); | |
^~~~~~~~~~~~~~~~~~~~ | |
error: aborting due to previous error |