Skip to content

micanzhang/ob-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ob-rust https://travis-ci.org/micanzhang/ob-rust.svg?branch=master

Introduction

ob-rust enables Org-Babel support for evaluating Rust code. It was created based on the usage of ob-C and ob-go.

#+begin_src rust
fn main() {
    let greetings = ["Hello", "Hola", "Bonjour",
                     "Ciao", "こんにちは", "안녕하세요",
                     "Cześć", "Olá", "Здравствуйте",
                     "chào bạn", "您好"];

    for (num, greeting) in greetings.iter().enumerate() {
        print!("{} : ", greeting);
        match num {
            0 =>  println!("This code is editable and runnable!"),
            1 =>  println!("Este código es editable y ejecutable!"),
            2 =>  println!("Ce code est modifiable et exécutable!"),
            3 =>  println!("Questo codice è modificabile ed eseguibile!"),
            4 =>  println!("このコードは編集して実行出来ます!"),
            5 =>  println!("여기에서 코드를 수정하고 실행할 수 있습니다!"),
            6 =>  println!("Ten kod można edytować oraz uruchomić!"),
            7 =>  println!("Esse código é editável e executável!"),
            8 =>  println!("Этот код можно отредактировать и запустить!"),
            9 =>  println!("Bạn có thể edit và run code trực tiếp!"),
            10 =>  println!("这段代码是可以编辑并且能够运行的!"),
            _ =>  {},
        }
    }
}
#+end_src

:

#+resutls:
Hello : This code is editable and runnable!
Hola : Este código es editable y ejecutable!
Bonjour : Ce code est modifiable et exécutable!
Ciao : Questo codice è modificabile ed eseguibile!
こんにちは : このコードは編集して実行出来ます!
안녕하세요 : 여기에서 코드를 수정하고 실행할 수 있습니다!
Cześć : Ten kod można edytować oraz uruchomić!
Olá : Esse código é editável e executável!
Здравствуйте : Этот код можно отредактировать и запустить!
chào bạn : Bạn có thể edit và run code trực tiếp!
您好 : 这段代码是可以编辑并且能够运行的!

Requirements

rust and cargo

To install rust, run the following in your terminal:

curl https://sh.rustup.rs -sSf | sh

for more details or other methods installation, please visit: https://www.rust-lang.org/en-US/install.html

cargo script

You can install rust-script using Cargo’s install subcommand:

cargo install rust-script

TODOs

  • replace rust-script with rustc and run binary.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published