Skip to content

OSS Gate Workshop: Fukuoka: 2019-9-10: kawadumax: Actix-web: Work log #1267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kawadumax opened this issue Sep 10, 2019 · 24 comments
Closed

Comments

@kawadumax
Copy link

This is a work log of a "OSS Gate workshop".
"OSS Gate workshop" is an activity to increase OSS developers.
Here's been discussed in Japanese. Thanks.

作業ログ作成時の説明

以下のテンプレートを埋めてタイトルに設定します。埋め方例はスクロールすると見えてきます。

OSS Gate Workshop: ${LOCATION}: ${YEAR}-${MONTH}-${DAY}: ${ACCOUNT_NAME}: ${OSS_NAME}: Work log

タイトル例↓:

OSS Gate Workshop: Tokyo: 2017-01-16: kou: Rabbit: Work log

OSS Gateワークショップ関連情報

  • スライド:ワークショップの進行に使っているスライドがあります。
  • チャット:OSS開発に関することならなんでも相談できます。ワークショップが終わった後もオンラインで相談しながら継続的にOSSの開発に参加しましょう!
  • シナリオ:ワークショップの目的・内容・進め方の詳細が書いています。
  • 過去のビギナーの作業ログ:他の人の作業ログから学べることがいろいろあるはずです。
@kawadumax kawadumax changed the title OSS Gate Workshop: Fukuoka: 2019-9-10: kawadumax: vscode(暫定): Work log OSS Gate Workshop: Fukuoka: 2019-9-10: kawadumax: Rails: Work log Sep 10, 2019
@kawadumax kawadumax changed the title OSS Gate Workshop: Fukuoka: 2019-9-10: kawadumax: Rails: Work log OSS Gate Workshop: Fukuoka: 2019-9-10: kawadumax: Actix-web: Work log Sep 10, 2019
@nagachika
Copy link
Contributor

よろしくお願いします!!

@nagachika
Copy link
Contributor

リポジトリはこちらでしょうか https://github.com/actix/actix-web

@kawadumax
Copy link
Author

よろしくお願いします!!

こちらこそよろしくおねがいします!
https://github.com/actix/actix-web
ここのレポジトリのREADMEから追ってみようと思っています!

@kawadumax
Copy link
Author

リポジトリはこちらでしょうか https://github.com/actix/actix-web

お、そうです〜〜rustのwebフレームワークですね

@kawadumax
Copy link
Author

まず、READMEを見るも、installのような項目はないので、盲目的にuser guideをおいかけてみます

@nagachika
Copy link
Contributor

このプロジェクトは Apache Lincense 2.0 と MIT License のデュアルライセンス(利用者が好きなほうを選ぶ)みたいですね。ちょっと変わり種ですね。

@kawadumax
Copy link
Author

このプロジェクトは Apache Lincense 2.0 と MIT License のデュアルライセンス(利用者が好きなほうを選ぶ)みたいですね。ちょっと変わり種ですね。

なるほど...licenseしっかりみてなかったです

@kawadumax
Copy link
Author

https://actix.rs/docs/installation/ をみてみると、インストール用の項目がある
ちなみに環境は

  • OS == manjaro
  • shell == fish

@kawadumax
Copy link
Author

Installing Rust
Since actix-web is a Rust framework you will need Rust to get started with it. If you don’t have it yet we recommend you use rustup to manage your Rust installation. The official rust guide has a wonderful section on getting started.

We currently require at least Rust 1.34 so make sure you run rustup update to have the latest and greatest Rust version available. In particular this guide will assume that you actually run Rust 1.34 or later.

rustの1.34以降をいれろ、とあるので入れようとする。

現在インストール済みのrustのバージョンを調べるために、他のサイトへ移動

@kawadumax
Copy link
Author

http://etc9.hatenablog.com/entry/2017/08/29/002720

を参照し、

rustc -V

で現在のバージョンがわかることが判明、無事に1.35が入っており、rust環境の条件を満たすことを確認した。次に元のページに戻る。

@kawadumax
Copy link
Author

kawadumax commented Sep 10, 2019

Installing actix-web
Thanks to Rust’s cargo package manager you won’t need to explicitly install actix-web. Just depend on it and you’re ready to go. For the unlikely case that you want to use the development version of actix-web you can depend on the git repository directly.

Release version:

[dependencies]
actix-web = "1.0"
Development version:

[dependencies]
actix-web = { git = "https://github.com/actix/actix-web" }

と書かれており、どうやればいいのか少し迷うも、この記述はcargo.toml[dependency]に書くやつだなぁと思い至り、

cd ~/Documents/rust_projects/
cargo new hoge

として新しいプロジェクトフォルダを作成する

@kawadumax
Copy link
Author

cargo new アプリ名

で生成されたファイル群は以下

Screenshot from 2019-09-10 20-06-25

@kawadumax
Copy link
Author

kawadumax commented Sep 10, 2019

ここのcargo.tomlのdependencyに公式サイト記載のactix-web = "1.0"を書いてみる
この段階でcargo runを行い実行してみると、依存パッケージがインストールされた。

@kawadumax
Copy link
Author

kawadumax commented Sep 10, 2019

ここまで書いて次に何をすべきかわからなくなった(何しろmain.rsを一文字も書いてないので実行しても意味がない)ので
次にbasicsの項目の中のgetting startedをみてみる

@kawadumax
Copy link
Author

https://actix.rs/docs/getting-started/ をみてみると、具体的なインストール方法は主にこちらに書かれているような印象を受けた。
dependencyに記述してあるところまで飛ばして、コードをmain.rsにコピペしてみる

@kawadumax
Copy link
Author

kawadumax commented Sep 10, 2019

ここでvscode上でこのような警告がでた

Unknown RLS configuration: `crate_blacklist`

rustのランゲージサーバーの問題?みたいなので最悪こちらに対してフィードバックを返そうと思う
Screenshot from 2019-09-10 20-16-40

@kawadumax
Copy link
Author

use actix_web::{web, App, HttpResponse, HttpServer, Responder};

fn index() -> impl Responder {
    HttpResponse::Ok().body("Hello world!")
}

fn index2() -> impl Responder {
    HttpResponse::Ok().body("Hello world again!")
}

fn main() {
    HttpServer::new(|| {
        App::new()
            .route("/", web::get().to(index))
            .route("/again", web::get().to(index2))
    })
    .bind("127.0.0.1:8088")
    .unwrap()
    .run()
    .unwrap();
}

を公式からコピペして記述したところ、普通に起動してサーバーにアクセスできてしまい、ちょっと他のOSSを探したりしてもいいのかなという気持ちが生まれています
Screenshot from 2019-09-10 20-26-11

@kawadumax
Copy link
Author

普通にactix-webが動いたので、途中で出てきたRLSの警告をみてみるべく、レポジトリを覗いてみたら、既にissueが上がっていました
rust-lang/vscode-rust#656

@kawadumax
Copy link
Author

ということでコメントしてきました。
rust-lang/vscode-rust#656 (comment)
他のrustのOSSをみてみようかと思います〜openGLとか依存が多くて失敗しそうでいいかもしれません

@kawadumax
Copy link
Author

actixは昨日すんなり通ってしまったので、上記のRLSの報告に関して、バグが発生しているコードまで追い込んでみようと思っています。

@kawadumax
Copy link
Author

とりあえずforkして、cloneして、該当箇所と思われるところを修正してコミットしてpushまでしてみたんですけど、拡張機能のローカルでのソースコードからのインストールと実行がわからなくて、修正が正しいのかどうかの確認ができてません
https://github.com/kawadumax/rls-vscode/tree/change-default-value-of-crate-blacklist

@nagachika
Copy link
Contributor

なるほど、すばらしい進捗だと思います。
こちらに開発用のちょっとしたドキュメントがあったので参考になれば
https://github.com/rust-lang/rls-vscode/blob/master/contributing.md

@kawadumax
Copy link
Author

kawadumax commented Sep 11, 2019

PRのコメント(えいご)の下書き

For issue #656 
I tryed to remove suspicious default value of "null" from type field in `crate_blacklist`

But I could not  test it on my laptop. I tryed to follow the instruction of `contributing.md`, but I can not understand it.
So could you test this PR? or tell me something simple process of test ( sorry )  ?

@kawadumax
Copy link
Author

rust-lang/vscode-rust#660

PRを出してみました〜 新鮮な体験でした

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants