#run #mark #proc-macro

nightly init

Mark a function to run before main

3 unstable releases

Uses old Rust 2015

0.2.0 Feb 15, 2017
0.1.1 Feb 14, 2017
0.1.0 Feb 14, 2017

#33 in #mark

MIT/Apache

3KB

init

Rust Crates.io Docs.rs

Mark a function to run before main.

Install

[dependencies]
init = "0.2"

[build-dependencies]
init = "0.2"

Usage

src/main.rs

#![feature(proc_macro)]

extern crate init;
use init::init;

#[init]
fn init() {
    // [...]
}

build.rs

extern crate init;

fn main() {
  init::build();
}

License

Init is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.


lib.rs:

Mark a function to run before main.

src/main.rs

extern crate init;
use init::init;

#[init]
fn init() {
}

fn main() {
}

build.rs

extern crate init;

fn main() {
    init::build();
}

Dependencies

~2MB
~44K SLoC