=> val, $crate::result::Result::Err(err) => { return $crate::result::Result::Err($crate::convert::From::from(err)) } }) } fn write_to_file_using_try() -> Result<(), io::Error> { let mut file = try!(File::create("my_best_friends.txt")); try!(file.write_all(b"This is a list of my best friends.")); println!("I wrote to the file"); Ok(()) } 標準のtry! マクロ (https://github.com/rust-lang/rust/blob/master/src/libcore/macros.rs) このマクロの意味はRust bookのエラーハンドリングを参照 https://rust-lang-ja.github.io/the-rust-programming-language-ja/1.6/book/error-handling.html
match && match.valid? match.define send(name, *arguments, &block) else super end end dynamic_matchers.rb (https://github.com/rails/rails/blob/4-2-stable/activerecord/lib/active_record/dynamic_matchers.rb) 定義する def define model.class_eval <<-CODE, __FILE__, __LINE__ + 1 def self.#{name}(#{signature}) #{body} end CODE end 呼び出す Client.find_by_first_name("HogeHoge")