を作った。
{{ embedly(title="ubnt-intrepid/tweet-at-compile-time", url=" https://github.com/ubnt-intrepid/tweet-at-compile-time ") }}
使い方
※ compiler plugin を使用しているため nightly チャンネル必須
-
おもむろにクレートを作る
$ cargo new hoge --bin-
依存関係にプラグインを追加する
$ git clone https://github.com/ubnt-intrepid/tweet-at-compile-time.git tweet-at-compile-time[dependencies]
tweet-at-compile-time = { path = "./tweet-at-compile-time/" }-
Consumer Token, Consumer Secret, Access Token, Access Secret を手に入れ、
tweet-at-compile-time/keys以下に保存する
$ mkdir -p tweet-at-compile-time/keys
$ echo xxxxx > tweet-at-compile-time/keys/consumer_key
$ ...-
main.rsを書き換える
#![feature(plugin)]
#![plugin(tweet_at_compile_time)]
fn main() {
tweet!("Hello!");
}-
コンパイルする
$ cargo build # cargo run ではない点に注意今後の展望
ネタなのでこれ以上手をかける気はないですが、トークンの読み込み周りが気に入らないのでそのうち直したい。