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

There's more...

The regexes work by compiling their strings into the equivalent Rust code on creation. For performance reasons, you are advised to reuse your regexes instead of creating them anew every time you use them. A good way of doing this is by using the lazy_static crate, which we will look at later in the book, in the Creating lazy static objects section in Chapter 5, Advanced Data Structures.

Be careful not to overdo it with regexes. As they say, "When all you have is a hammer, everything looks like a nail." If you parse complicated data, regexes can quickly become an unbelievably complex mess. When you notice that your regex has become too big to understand at first glance, try to rewrite it as a parser.
主站蜘蛛池模板: 长岭县| 贵州省| 江门市| 建德市| 延川县| 察哈| 剑川县| 越西县| 大洼县| 萍乡市| 德清县| 北宁市| 绥江县| 新野县| 彭州市| 宽甸| 肃宁县| 普陀区| 连江县| 扶风县| 乌兰浩特市| 井冈山市| 湘西| 白银市| 开原市| 青河县| 雷山县| 新竹县| 宜良县| 万年县| 丹东市| 永仁县| 广元市| 周至县| 襄樊市| 沙洋县| 肇庆市| 洪湖市| 连州市| 阳朔县| 宣威市|