Action | Mix | Cargo |
---|---|---|
Create a project | mix new [--app APP] PATH |
cargo new [--bin] PATH |
Run your project | iex -S mix / mix run --no-halt / mix phoenix.server |
cargo run |
Get help | mix help cmd |
cargo [cmd] --help |
Build configuration | mix.exs | Cargo.toml |
Project commands | mix COMMAND |
N/A |
Global add-on commands | mix archive.install PACKAGE |
cargo install PACKAGE |
Integrating with other languag |
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
$ ./mach test-dromaeo --release | |
Already up-to-date. | |
make: Entering directory '/home/michael/Experiments/Rust/servo/tests/dromaeo/dromaeo' | |
make: 'web' is up to date. | |
make: Leaving directory '/home/michael/Experiments/Rust/servo/tests/dromaeo/dromaeo' | |
Testing Dromaeo on Servo! | |
[dromaeo] Mesh Transform | |
[dromaeo] Mesh Transform | |
[dromaeo] Mesh Transform | |
[dromaeo] Mesh Transform |
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
rr: Saving the execution of `/<home>/servo/target/debug/servo' to trace directory `/<home>/.rr/servo-2'. | |
[glutin] x error code=35 major=0 minor=0! | |
[glutin] x error code=38 major=0 minor=0! | |
[glutin] x error code=39 major=0 minor=0! | |
[glutin] x error code=39 major=0 minor=0! | |
thread '<main>' panicked at 'glx::MakeCurrent failed', /<home>/servo/.cargo/git/checkouts/glutin-266ef3a474e2d7ce/servo/src/x11/window/mod.rs:781 |
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 std::io::{self, Read, Write}; | |
fn main() { | |
let mut reader = ioㆍstdin().bytes(); | |
let mut writer = ioㆍstdout(); | |
let mut data = [0u8; 1024]; | |
let mut stack; | |
let program = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.".as_bytes(); | |
let mut ptr = 0; | |
let mut pc = 0; | |
while pc != program.len() { |
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
valgrind --soname-synonyms=somalloc=NONE --suppressions=etc/valgrind-memcheck.supp ./target/release/servo --resources-path resources/ | |
==1162== Memcheck, a memory error detector | |
==1162== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. | |
==1162== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info | |
==1162== Command: ./target/release/servo --resources-path resources/ | |
==1162== | |
==1162== Warning: noted but unhandled ioctl 0x6458 with no size/direction hints. | |
==1162== This could cause spurious value errors to appear. | |
==1162== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. | |
==1162== Thread 9 Constellation: |
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
$ gdb ./target/debug/servo | |
GNU gdb (GDB) Fedora 7.9.1-20.fc22 | |
Copyright (C) 2015 Free Software Foundation, Inc. | |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | |
This is free software: you are free to change and redistribute it. | |
There is NO WARRANTY, to the extent permitted by law. Type "show copying" | |
and "show warranty" for details. | |
This GDB was configured as "x86_64-redhat-linux-gnu". | |
Type "show configuration" for configuration details. | |
For bug reporting instructions, please see: |
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
defmodule Split do | |
@moduledoc """ | |
iex(2)> Split.split("this,is,1,way,to,do_it") | |
["this", "is", "1", "way", "to", "do", "it"] | |
""" | |
@spec split(bitstring) :: [bitstring] | |
def split(s) do | |
do_split(s, [], []) | |
|> Enum.map(&List.to_string/1) | |
|> Enum.map(&String.reverse/1) |
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
defmodule Enum2 do | |
@type t :: Enum.t | |
@doc """ | |
If `enum` starts with `prefix`, return true. Otherwise, return false. | |
### Examples | |
iex> Enum.starts_with?([1, 2, 3], [1, 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
### General List of Reserved Words | |
### Stuart P. Bentley <[email protected]>, June 4, 2013 | |
### Michael Howell <[email protected]>, April 5, 2017 | |
## This is a general list of words you may want to consider reserving, | |
## in a system where users can pick any name, in a context where the | |
## system may use names as well. One prominent example of a system | |
## where this is the case would be a site that serves pages for users, | |
## at their username, from the site root, like | |
## http://twitter.com/stuartpb . In this system, you would want to |
OlderNewer