{"id":187163,"date":"2020-10-30T10:49:37","date_gmt":"2020-10-30T02:49:37","guid":{"rendered":"http:\/\/4563.org\/?p=187163"},"modified":"2020-10-30T10:49:37","modified_gmt":"2020-10-30T02:49:37","slug":"rust-for-loop","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=187163","title":{"rendered":"rust for loop"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  rust for loop               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : faker1 <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u60f3\u904d\u5386\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u534a\u5929\u6ca1\u6709\u627e\u5230\u80fd work \u7684<\/p>\n<pre><code>name=\"hello world\" for (i:=name.len();i&gt;0;i++){     \/\/ rust \u4e2d\u6ca1\u6709\u8fd9\u79cd\u6bd4\u8f83\u7b80\u5355\u7684\u5199\u6cd5\uff0c \u53ea\u80fd loop ? }  loop{     \/\/ DOOOOOOOO }  <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4054362\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Co1a <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             let mut a = String::from(&#8220;food&#8221;);<br \/> for i in 0..a.len() {<br \/> print!(&#8220;{} &#8220;, a.as_bytes()[i] as char);<br \/> }                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4054363\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Co1a <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f18\u96c5\u7684\u5199\u6cd5<br \/>&#8220;`rust<br \/>for i in a.chars() {<br \/> print!(&#8220;{} &#8220;, i );<br \/>}<br \/>&#8220;`                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4054364\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lostpg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ea\u662f\u5b57\u5e55\u6570\u5b57\u7684\u8bdd\u7528 as_bytes\uff0c\u904d\u5386 unicode code points \u7684\u8bdd\uff0cchars() \u548c char_indices() \u65b9\u6cd5\u3002\u5982\u679c\u6709\u7684\u5b57\u7b26\u662f\u591a\u4e2a code points \u7ec4\u6210\u7684\u8bdd\uff0c\u7528 https:\/\/crates.io\/crates\/unicode-segmentation \u8fd9\u4e2a crate \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>rust for loop \u8cc7\u6df1\u5927&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/187163"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=187163"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/187163\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=187163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=187163"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=187163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}