官术网_书友最值得收藏!

Irrefutable patterns

Another form of pattern matching is irrefutable patterns. A pattern is irrefutable when there's only one way to match it and it always succeeds. For instance, another way to get the elements of a tuple is with an irrefutable pattern:

let tuple = (24, 42);
let (a, b) = tuple;
println!("{}, {}", a, b);

In the second line, we assign the first element of the tuple to a and the second to b.

主站蜘蛛池模板: 锦州市| 安庆市| 宝应县| 辉南县| 杭锦后旗| 彰化县| 枝江市| 武清区| 石狮市| 岗巴县| 海伦市| 深圳市| 宁城县| 岳池县| 东丽区| 虎林市| 周口市| 会泽县| 登封市| 孝昌县| 莱芜市| 舟曲县| 翼城县| 兴化市| 靖宇县| 历史| 彩票| 华亭县| 清水县| 蒲江县| 安溪县| 泰州市| 资讯 | 巴林左旗| 镇坪县| 同仁县| 平武县| 信丰县| 扶余县| 舞阳县| 二手房|