{"id":45330,"date":"2023-12-02T10:44:23","date_gmt":"2023-06-07T08:18:20","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/"},"modified":"2024-05-04T11:47:52","modified_gmt":"2024-05-04T03:47:52","slug":"45330-2","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/","title":{"rendered":""},"content":{"rendered":"<h1>\u5c0e\u5165<\/h1>\n<p>\u4eca\u307e\u3067Java\u3001Python\u3057\u304b\u89e6\u3063\u3066\u3053\u306a\u304b\u3063\u305f\u306e\u3067<br \/>\n\u4eca\u66f4\u306a\u304c\u3089RUST\u306e\u7279\u5fb4\u3092\u52c9\u5f37\u3057\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306f\u3001RUST\u306e\u901f\u3055\u304c\u3069\u3046\u3044\u3046\u4ed5\u7d44\u307f\u3067\u5b9f\u73fe\u3067\u304d\u3066\u3044\u308b\u304b\uff1f\u306e<br \/>\n\u3055\u308f\u308a\u90e8\u5206\u3092\u8abf\u3079\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h1>RUST\u3068\u306f\uff1f<\/h1>\n<h3>RUST\u306e\u6982\u8981<\/h3>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Mozilla\u304c\u652f\u63f4\u3059\u308b\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306e\u30b7\u30b9\u30c6\u30e0\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">C\u8a00\u8a9e\u3001C++\u306b\u4ee3\u308f\u308b\u8a00\u8a9e\u3092\u76ee\u6307\u3057\u3066\u3044\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u624b\u7d9a\u304d\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3001\u95a2\u6570\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306a\u3069\u306e\u5b9f\u88c5\u624b\u6cd5\u3092\u30b5\u30dd\u30fc\u30c8<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5b9f\u884c\u6642\u901f\u5ea6\u6027\u80fd\u306fC\u8a00\u8a9e\u3068\u540c\u7b49\u7a0b\u5ea6<\/ul>\n<\/li>\n<\/ul>\n<p>\u5f37\u529b\u306a\u578b\u30b7\u30b9\u30c6\u30e0\u3068\u30ea\u30bd\u30fc\u30b9\u7ba1\u7406\u306e\u4ed5\u7d44\u307f\u306b\u3088\u308a\u3001\u30e1\u30e2\u30ea\u5b89\u5168\u6027\u304c\u4fdd\u8a3c\u3055\u308c\u3066\u3044\u308b<\/p>\n<h3>RUST\u3092\u69cb\u6210\u3059\u308b\uff13\u3064\u306e\u67f1<\/h3>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9<\/ul>\n<\/li>\n<\/ul>\n<p>\u30e1\u30e2\u30ea\u52b9\u7387\u304c\u9ad8\u304f\u30e9\u30f3\u30bf\u30a4\u30e0\u3084\u30ac\u30d9\u30fc\u30b8\u30b3\u30ec\u30af\u30bf\u304c\u306a\u3044<br \/>\n\u7d44\u8fbc\u307f\u6a5f\u5668\u4e0a\u3067\u306e\u5b9f\u884c\u30fb\u4ed6\u306e\u8a00\u8a9e\u3068\u306e\u8abf\u548c\u3082\u7c21\u5358\u306b\u3067\u304d\u308b<\/p>\n<p>\u4fe1\u983c\u6027<\/p>\n<p>\u8c4a\u304b\u306a\u578b\u30b7\u30b9\u30c6\u30e0\u3068\u6240\u6709\u6a29\u30e2\u30c7\u30eb<br \/>\n\u30e1\u30e2\u30ea\u5b89\u5168\u6027\u3068\u30b9\u30ec\u30c3\u30c9\u5b89\u5168\u6027\u304c\u4fdd\u8a3c\u3055\u308c\u3066\u3044\u308b<br \/>\n\u69d8\u3005\u306a\u7a2e\u985e\u306e\u30d0\u30b0\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u6392\u9664\u53ef\u80fd<\/p>\n<p>\u751f\u7523\u6027<\/p>\n<p>\u512a\u308c\u305f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3068\u30b3\u30f3\u30d1\u30a4\u30e9<br \/>\n\u7d71\u5408\u3055\u308c\u305f\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u3068\u30d3\u30eb\u30c9\u30c4\u30fc\u30eb<br \/>\n\u591a\u6570\u306e\u30a8\u30c7\u30a3\u30bf\u306b\u5bfe\u5fdc\u3059\u308b\u30b9\u30de\u30fc\u30c8\u306a\u81ea\u52d5\u88dc\u5b8c\u3068\u578b\u691c\u67fb\u6a5f\u80fd\u3001\u81ea\u52d5\u30d5\u30a9\u30fc\u30de\u30c3\u30bf<\/p>\n<p>\u307b\u307c\u516c\u5f0f\u304b\u3089\u306e\u30b3\u30d4\u30da\u3067\u3059\u304c\u3053\u3093\u306a\u3068\u3053\u308d\u3067\u3057\u3087\u3046\u304b\u3002<br \/>\n\u4eca\u56de\u306f\u592a\u5b57\u7b87\u6240\u306e\u3001\u901f\u5ea6\u3068\u5b89\u5168\u6027\u3092\u6398\u308a\u4e0b\u3052\u3066\u884c\u304d\u307e\u3059\u3002<\/p>\n<h2>RUST\u306f\u306a\u305c\u901f\u304f\u3066\u5b89\u5168\u306a\u306e\u304b\uff1f<\/h2>\n<p>RUST\u306e\u7279\u5fb4\u3068\u3057\u3066\u306f\u4ee5\u4e0b\u306e\uff13\u70b9\u304c\u3042\u3052\u3089\u308c\u307e\u3059\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u30ac\u30fc\u30d9\u30b8\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u304c\u306a\u3044<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u76f4\u63a5\u6a5f\u68b0\u8a9e\u306b\u30b3\u30f3\u30d1\u30a4\u30eb\u3055\u308c\u308b<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\u30bc\u30ed\u30b3\u30b9\u30c8\u62bd\u8c61\u5316<\/ol>\n<h4>1.\u30ac\u30d9\u30fc\u30b8\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u304c\u306a\u3044<\/h4>\n<p>GC\u3068\u3044\u3048\u3070Java\u304c\u6709\u540d\u3067\u3059\u3088\u306d\u3002<br \/>\nGC\u81ea\u4f53\u306f\u60aa\u3044\u3082\u306e\u3067\u306f\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u6027\u80fd\u304c\u4f4e\u4e0b\u3059\u308b\u4e00\u756a\u306e\u8981\u56e0\u3067\u3059\u3057\u3001<br \/>\n\u3069\u3093\u306a\u306b\u9811\u5f35\u3063\u3066\u3082\u4e16\u4ee3\u5225GC\u3092\u5229\u7528\u3059\u308b\u30b7\u30b9\u30c6\u30e0\u3067\u306fGC\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\n\u53c2\u8003\uff1aJava\u306eGC\u306e\u4ed5\u7d44\u307f\u3092\u6574\u7406\u3059\u308b<\/p>\n<p>RUST\u306e\u30e1\u30e2\u30ea\u7ba1\u7406\u306e\u57fa\u672c\u7684\u306a\u8003\u3048\u65b9\u306f\u4ee5\u4e0b\u3067\u8868\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u95a2\u6570\u306e\u30b9\u30b3\u30fc\u30d7\u304b\u3089\u5916\u308c\u308b \u53c8\u306f \u6240\u6709\u6a29\u304c\u8b72\u6e21\u3055\u308c\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 \u2192 \u7834\u68c4\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5024\u3092\u95a2\u6570\u3078\u4ee3\u5165\u3059\u308b \u2192 \u6240\u6709\u6a29\u304c\u8b72\u6e21\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u6240\u6709\u6a29\u3092\u6e21\u3057\u305f\u304f\u306a\u3044\u3068\u304d\u3000\u2192 \u53c2\u7167\u3092\u4f7f\u3046<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u3053\u308c\u3089\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u30c1\u30a7\u30c3\u30af\u3067\u304d\u308b<\/ul>\n<p>\u53c2\u8003\uff1aRust\u306e\u30e1\u30e2\u30ea\u7ba1\u7406\u3063\u3066\u9762\u767d\u3044<\/p>\n<p>RUST\u306f\u4e0a\u8a18\u306e\u6240\u6709\u6a29\u306e\u8003\u3048\u65b9\u3092\u7528\u3044\u308b\u3053\u3068\u3067\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u89e3\u653e\u3059\u308b\u3079\u304d\u5834\u6240\u304c\u30b3\u30f3\u30d1\u30a4\u30e9\u76ee\u7dda\u304b\u3089\u3082\u5206\u304b\u308b\u305f\u3081\u3001 GC\u304c\u306a\u304f\u3066\u3082\u30e1\u30e2\u30ea\u3092\u6b63\u3057\u304f\u89e3\u653e\u3067\u304d\u307e\u3059\u3002<br \/>\n\u305d\u306e\u305f\u3081\u3001\u4eba\u9593\u304cfile.Close()\u3084free()\u7b49\u300c\u30ea\u30bd\u30fc\u30b9\u3092\u89e3\u653e\u3059\u308b\u305f\u3081\u306e\u64cd\u4f5c\u300d\u306f Rust \u3067\u306f\u4e0d\u8981\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u308b\u306a\u3089\u3070\u3001\u4eba\u9593\u306f\u7d76\u5bfe\u30e1\u30e2\u30ea\u30ea\u30fc\u30af\u3055\u305b\u308b\u306e\u3067\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u5168\u90e8\u30b3\u30f3\u30d1\u30a4\u30e9\u5074\u3067\u7834\u68c4\u524d\u63d0\u3067\u7ba1\u7406\u3055\u308c\u307e\u3059 \u3068\u3044\u3046\u3001<br \/>\n\u6027\u60aa\u8aac\u7684\u306a\u8003\u3048\u65b9\u3092\u6301\u3063\u3066\u3044\u308b \u3063\u3066\u611f\u3058\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<h4>2.\u76f4\u63a5\u6a5f\u68b0\u8a9e\u306b\u30b3\u30f3\u30d1\u30a4\u30eb\u3055\u308c\u308b<\/h4>\n<p>Rust\u306fC\u3001C++\u540c\u69d8\u306b\u3001\u76f4\u63a5\u6a5f\u68b0\u8a9e\u3092\u751f\u6210\u3057\u3066\u5b9f\u884c\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\nJava\u3084python\u306f\u3001\u30de\u30eb\u30c1\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u4e0a\u3067\u52d5\u304b\u3059\u305f\u3081\u306b\u5b9f\u884c\u6642\u306b\u30d0\u30a4\u30c8\u30b3\u30fc\u30c9\uff08\u4e2d\u9593\u30b3\u30fc\u30c9\uff09\u3092\u751f\u6210\u3057\u3001\u4eee\u60f3\u30de\u30b7\u30f3(PVM,JVM\u7b49)\u3067\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u305f\u3081\u3001\u901f\u5ea6\u3067\u306f\u6a5f\u68b0\u8a9e\u3067\u5b9f\u884c\u3055\u308c\u308bRUST\u306e\u65b9\u306b\u5206\u914d\u304c\u4e0a\u304c\u308a\u307e\u3059\u304c\u3001<br \/>\n\u5229\u7528\u3059\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u6bce\u306b\u8abf\u6574\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u4e8b\u306f\u899a\u3048\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u53c2\u8003\uff1aRust\u304cC++\u306b\u901f\u5ea6\u3067\u52dd\u3063\u305f\u8a71<br \/>\n\u53c2\u8003\uff1aJava \u4eee\u60f3\u30de\u30b7\u30f3 (JVM)<\/p>\n<h4>3.\u30bc\u30ed\u30b3\u30b9\u30c8\u62bd\u8c61\u5316<\/h4>\n<p>\u30bc\u30ed\u30b3\u30b9\u30c8\u62bd\u8c61\u5316\u3068\u306fRUST\u7279\u6709\u306e\u8003\u3048\u65b9\u3067\u3001\u6587\u5b57\u901a\u308a\u3001\u30b3\u30b9\u30c8\u304c\u306a\u3044(\u30bc\u30ed)\u62bd\u8c61\u5316\u306e\u3053\u3068<br \/>\nC++\u306e\u6982\u5ff5\u3067\u3042\u308b\u3001\u300c\u30bc\u30ed\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u539f\u5247\u300d\u3092\u3082\u3068\u306b\u3057\u3066\u3044\u3066\u3001<br \/>\n\u4e00\u8a00\u3067\u3044\u3046\u3068\u300c\u5b9f\u884c\u3059\u308b\u3053\u3068\u306b\u5bfe\u3057\u3066\u4f59\u8a08\u306a\u30b3\u30fc\u30c9(GC\u3084\u9593\u63a5\u53c2\u7167)\u3067CPU\u3092\u6d88\u8cbb\u3057\u306a\u3044\u300d\u3068\u3044\u3046\u8003\u3048\u65b9\u3067\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u304a\u3051\u308b\u62bd\u8c61\u5316\u3068\u306f\u3001\u5171\u901a\u90e8\u5206\u3092\u62bd\u51fa\u3057\u3001\u305d\u306e\u8a73\u7d30\u3092\u30d6\u30e9\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u5316\u3059\u308b\u3053\u3068\u3067\u3059\u3002<br \/>\n\u3053\u308c\u306b\u3088\u308a\u4ed5\u69d8\u5909\u66f4\u306b\u5f37\u304f\u3001\u518d\u5229\u7528\u6027\u306e\u9ad8\u3044\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u958b\u767a\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u62bd\u8c61\u5316\u306e\u4f8b\uff1a<\/p>\n<pre class=\"post-pre\"><code><span class=\"n\">def<\/span> <span class=\"nf\">transfer_gold<\/span><span class=\"o\">(<\/span><span class=\"n\">amount<\/span><span class=\"o\">,<\/span> <span class=\"n\">user_id<\/span><span class=\"o\">)<\/span>\r\n  <span class=\"n\">user_a<\/span> <span class=\"o\">=<\/span> <span class=\"nc\">User<\/span><span class=\"o\">.<\/span><span class=\"na\">find<\/span><span class=\"o\">(<\/span><span class=\"n\">user_id<\/span><span class=\"o\">)<\/span>\r\n  <span class=\"n\">user_a<\/span><span class=\"o\">.<\/span><span class=\"na\">gold<\/span> <span class=\"o\">-=<\/span> <span class=\"n\">amount<\/span>\r\n  <span class=\"n\">user_a<\/span><span class=\"o\">.<\/span><span class=\"na\">save<\/span><span class=\"o\">!<\/span>\r\n<span class=\"n\">end<\/span> \r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u306f\u300cuser_id\u306e\u30e6\u30fc\u30b6\u30fc\u306e\u53e3\u5ea7\u306bamount\u5186\u3092\u632f\u308a\u8fbc\u3080\u300d\u3068\u3044\u3046\u95a2\u6570\u3067\u3059\u3002<br \/>\n\u5f15\u6570\u3068\u3057\u3066\u6e21\u3055\u308c\u305f\u30e6\u30fc\u30b6\u30fc\u3084\u91d1\u984d\u7b49\u306e\u5024\u306e\u51e6\u7406\u65b9\u6cd5\u306f\u8a18\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001<br \/>\n\u5b9f\u969b\u306b\u95a2\u6570\u304c\u547c\u3073\u51fa\u3055\u308c\u308b\u307e\u3067\u5024\u306f\u308f\u304b\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u300c\u5177\u4f53\u7684\u306a\u5224\u65ad\u3092\u9045\u3089\u305b\u308b\u3053\u3068\u3067\u67d4\u8edf\u6027\u3092\u5f97\u308b\u4e8b\u304c\u3067\u304d\u308b\u300d\u3001\u304c\u62bd\u8c61\u306e\u30e1\u30ea\u30c3\u30c8\u3067\u3059\u304c\u3001<br \/>\n\u6b63\u78ba\u306a\u578b\u306f\u5b9f\u884c\u6642\u306b\u306a\u3063\u3066\u521d\u3081\u3066\u5224\u660e\u3059\u308b\u305f\u3081\u3001\u30a4\u30f3\u30e9\u30a4\u30f3\u5316\uff08\u30b3\u30f3\u30d1\u30a4\u30e9\u306b\u3088\u308b\u6700\u9069\u5316\u624b\u6cd5\uff09\u304c\u304d\u306a\u3044\u305f\u3081\u3001\u30b3\u30b9\u30c8\u304c\u304b\u304b\u308b\u3068\u3044\u3046\u30c7\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3055\u3066\u3001\u4e0a\u8a18\u306e\u30b3\u30b9\u30c8\u3068\u306f\u3001<br \/>\n\u30e1\u30e2\u30ea\u306e\u52d5\u7684\u5229\u7528 \uff08\u52d5\u7684\u30c7\u30a3\u30b9\u30d1\u30c3\u30c1\uff09\u306e\u3053\u3068\u3092\u6307\u3057\u307e\u3059<br \/>\n\u4f8b\u3048\u3070\u3001aomunt\u3067\u6271\u3044\u305f\u3044\u30c7\u30fc\u30bf\u306e\u30b5\u30a4\u30ba\u304c\u4e0d\u660e\u306a\u3068\u304d\u3084\u3001user_id\u306e\u578b\u304c\u72b6\u6cc1\u306b\u5fdc\u3058\u3066\u7570\u306a\u308b\u5834\u5408\u306b\u306f\u3001\u52d5\u7684\u306a\u30e1\u30e2\u30ea\u306e\u78ba\u4fdd\u3068\u89e3\u653e\u3092\u5229\u7528\u3057\u307e\u3059\u3002<br \/>\n\u3053\u308c\u3089\u306e\u3001<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30e1\u30e2\u30ea\u3092\u78ba\u4fdd\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30e1\u30e2\u30ea\u304c\u4f7f\u308f\u308c\u3066\u3044\u306a\u3044\u3053\u3068\u3092\u691c\u77e5\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u4f7f\u308f\u308c\u3066\u3044\u306a\u3044\u30e1\u30e2\u30ea\u9818\u57df\u3092\u89e3\u653e\u3059\u308b<\/ul>\n<p>\u3068\u3044\u3063\u305f\u5224\u65ad\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u3059\u308b\u3068\u304d\u306b\u3001\u30b3\u30b9\u30c8\u304c\u304b\u304b\u308b\u3000\u3068\u3044\u3046\u4e8b\u3067\u3059\u3002<\/p>\n<p>\u4e00\u65b9\u3001RUST\u3067\u306f\u3001\u62bd\u8c61\u5316\u3055\u308c\u305f\u95a2\u6570\u304c\u5b9f\u969b\u306b\u4f7f\u3063\u3066\u3044\u308b\u5177\u4f53\u7684\u306a\u578b\u3092\u30b3\u30f3\u30d1\u30a4\u30e9\u5f53\u3066\u306f\u3081\u3066\u3001\u5177\u4f53\u7684\u306a\u95a2\u6570\u3092\u4f5c\u308b\u3068\u3044\u3046\u3001\u300c\u9759\u7684\u30c7\u30a3\u30b9\u30d1\u30c3\u30c1\u300d\u3092\u524d\u63d0\u306b\u3057\u3066\u52d5\u3044\u3066\u3044\u307e\u3059\u3002<br \/>\n\u547c\u3073\u51fa\u3057\u7b87\u6240\u306f\u3053\u308c\u3089\u306e\u5177\u4f53\u7684\u306a\u95a2\u6570\u3092\u547c\u3073\u51fa\u3059\u5f62\u3067\u7f6e\u63db\u3055\u308c\u308b\u304b\u3089\u3001\u78ba\u4fdd\/\u89e3\u653e\u3068\u3044\u3063\u305f\u4f59\u8a08\u306a\u30b3\u30b9\u30c8\u304c\u306a\u304f\u306a\u308a\u307e\u3059\u3002<br \/>\n\u4f8b\u3048\u3070\u3001<\/p>\n<pre class=\"post-pre\"><code><span class=\"n\">def<\/span> <span class=\"nf\">main<\/span><span class=\"o\">()<\/span>\r\n <span class=\"n\">transfer_amount<\/span> <span class=\"o\">=<\/span> <span class=\"mi\">10000<\/span>\r\n <span class=\"n\">user_id<\/span> <span class=\"o\">=<\/span> <span class=\"s\">\"taro\"<\/span>\r\n <span class=\"n\">transfer_gold<\/span><span class=\"o\">(<\/span><span class=\"n\">transfer_amount<\/span><span class=\"o\">,<\/span> <span class=\"n\">user_id<\/span><span class=\"o\">)<\/span>\r\n<span class=\"n\">end<\/span>\r\n\r\n<span class=\"n\">def<\/span> <span class=\"nf\">transfer_gold<\/span><span class=\"o\">(<\/span><span class=\"n\">amount<\/span><span class=\"o\">,<\/span> <span class=\"n\">user_id<\/span><span class=\"o\">)<\/span>\r\n  <span class=\"n\">user_a<\/span> <span class=\"o\">=<\/span> <span class=\"nc\">User<\/span><span class=\"o\">.<\/span><span class=\"na\">find<\/span><span class=\"o\">(<\/span><span class=\"n\">user_id<\/span><span class=\"o\">)<\/span>\r\n  <span class=\"n\">user_a<\/span><span class=\"o\">.<\/span><span class=\"na\">gold<\/span> <span class=\"o\">-=<\/span> <span class=\"n\">amount<\/span>\r\n  <span class=\"n\">user_a<\/span><span class=\"o\">.<\/span><span class=\"na\">save<\/span><span class=\"o\">!<\/span>\r\n<span class=\"n\">end<\/span> \r\n<\/code><\/pre>\n<p>\u3068\u3044\u3046\u30bd\u30fc\u30b9\u3067\u3042\u308c\u3070\u3001<br \/>\ntransfer_gold\u306eamount\u306fint\u578b user_id\u306fstring\u578b\u3067\u78ba\u4fdd\u3057\u3066\u304f\u308c\u307e\u3059\u3002<br \/>\n\u30b3\u30ec\u306a\u3089\u3070\u30d7\u30ed\u30b0\u30e9\u30e0\u5b9f\u884c\u6642\u3067\u3082\u5229\u7528\u3059\u308b\u578b\u304c\u660e\u78ba\u306a\u306e\u3067\u30e1\u30e2\u30ea\u306e\u78ba\u4fdd\u3082\u52d5\u7684\u306b\u884c\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u305b\u3093\u3002<br \/>\n\u306a\u306e\u3067 \u62bd\u8c61\u5316\u306b\u5bfe\u3059\u308b\u8ffd\u52a0\u306e\u30b3\u30b9\u30c8 \u304c\u30bc\u30ed\u3067\u3042\u308b\u3068\u3044\u3046\u7406\u5c48\u3067\u3059\u3002<\/p>\n<p>\u53c2\u8003\uff1a\u30bc\u30ed\u30b3\u30b9\u30c8\u62bd\u8c61\u5316\u3068\u306f\u4e00\u4f53\u4f55\u306a\u306e\u304b<br \/>\n\u53c2\u8003\uff1arust \u52d5\u7684\u30c7\u30a3\u30b9\u30d1\u30c3\u30c1\u3068\u9759\u7684\u30c7\u30a3\u30b9\u30d1\u30c3\u30c1\u306e\u8abf\u67fb<\/p>\n<p>\u3082\u3061\u308d\u3093\u3001\u9759\u7684\u30c7\u30a3\u30b9\u30d1\u30c3\u30c1\u306e\u307f\u3067\u5b9f\u88c5\u3067\u304d\u306a\u3044\u30e1\u30bd\u30c3\u30c9\u3082\u5b58\u5728\u3059\u308b\u305f\u3081\u3001\u52d5\u7684\u30c7\u30a3\u30b9\u30d1\u30c3\u30c1\u3082\u5229\u7528\u3067\u304d\u307e\u3059\u304c\u3001<br \/>\nRUST\u3067\u306f\u9759\u7684\u30c7\u30a3\u30b9\u30d1\u30c3\u30c1\u3092\u30e1\u30a4\u30f3\u3067\u4f7f\u3046\u4e8b\u304c\u524d\u63d0\u3068\u306a\u3063\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u90e8\u5206\u306f\u3076\u3063\u3061\u3083\u3051\u81ea\u5206\u3082\u7406\u89e3\u3057\u3066\u3044\u306a\u3044\u3068\u3053\u308d\u306a\u306e\u3067\u3001<br \/>\n\u5b9f\u969b\u306b\u624b\u3092\u52d5\u304b\u3057\u3066\u691c\u8a3c\u3057\u3066\u898b\u305f\u307b\u3046\u304c\u826f\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u4ee5\u4e0a\u3001RUST\u306e\u7279\u6027\u3064\u3044\u3066\u8584\u304f\u8abf\u3079\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u4ed6\u8a00\u8a9e\u3068\u306e\u7d44\u307f\u5408\u308f\u305b\u3084\u3001MW\u30fb\u30d7\u30ed\u30bb\u30c3\u30b5\u30fbOS\u7b49\u3068\u306e\u76f8\u6027\u306a\u3069\u3082\u8fd1\u65e5\u4e2d\u306b\u8abf\u3079\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c0e\u5165 \u4eca\u307e\u3067Java\u3001Python\u3057\u304b\u89e6\u3063\u3066\u3053\u306a\u304b\u3063\u305f\u306e\u3067 \u4eca\u66f4\u306a\u304c\u3089RUST\u306e\u7279\u5fb4\u3092\u52c9\u5f37\u3057\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-45330","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>- Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:description\" content=\"\u5c0e\u5165 \u4eca\u307e\u3067Java\u3001Python\u3057\u304b\u89e6\u3063\u3066\u3053\u306a\u304b\u3063\u305f\u306e\u3067 \u4eca\u66f4\u306a\u304c\u3089RUST\u306e\u7279\u5fb4\u3092\u52c9\u5f37\u3057\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-07T08:18:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-04T03:47:52+00:00\" \/>\n<meta name=\"author\" content=\"\u96c5, \u609f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u96c5, \u609f\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/\",\"name\":\"- Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-06-07T08:18:20+00:00\",\"dateModified\":\"2024-05-04T03:47:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\",\"name\":\"\u96c5, \u609f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"caption\":\"\u96c5, \u609f\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"- Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/","og_locale":"zh_CN","og_type":"article","og_description":"\u5c0e\u5165 \u4eca\u307e\u3067Java\u3001Python\u3057\u304b\u89e6\u3063\u3066\u3053\u306a\u304b\u3063\u305f\u306e\u3067 \u4eca\u66f4\u306a\u304c\u3089RUST\u306e\u7279\u5fb4\u3092\u52c9\u5f37\u3057\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-06-07T08:18:20+00:00","article_modified_time":"2024-05-04T03:47:52+00:00","author":"\u96c5, \u609f","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u96c5, \u609f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/","name":"- Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-06-07T08:18:20+00:00","dateModified":"2024-05-04T03:47:52+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6","name":"\u96c5, \u609f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","caption":"\u96c5, \u609f"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/45330-2\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/45330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=45330"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/45330\/revisions"}],"predecessor-version":[{"id":98137,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/45330\/revisions\/98137"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=45330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=45330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=45330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}