# Rust 函数式 Rust 函数结果作为下一个函数的输入,类似 `let vec = "ada".chars().collect::>();` ```rust fn main() { let vec = "abc"; let tem = vec.chars().collect::>(); let a = Foo(1); let b = a.add_one().add_two(); println!("{:?}", b); } #[derive(PartialEq,Debug)] struct Foo(i32); impl Foo { fn add_one(self) -> Bar { Bar::new(self.0) } } #[derive(PartialEq,Debug)] struct Bar(i32); impl Bar { fn new(i: i32) -> Bar { Bar(i) } fn add_two(self) -> Bar { Bar(self.0 + 2) } } ```