我想从javascript中定义一个字符串,并将其转换为Rust。在javascript中,字符串的定义如下:
var t = '5d.4n({"21":1u,"22":"25","26":"1u.2b","2l":2e,"2f":"2h","2j":["3-2k-2a.4.2","3-1t-1Y.4.2","3-1t-1J.4.2","3-1L-1M.4.2","3-1s-1O.4.2","3-1s-1R.4.2","3-1r-1T.4.2","3-1r-1W.4.2","3-1p-2m.4.2","3-1p-2N.4.2","3-1n-2R.4.2","3-1n-36.4.2","3-1l-2Z.4.2","3-1l-33.4.2","3-1j-2K.4.2","3-1j-2q.4.2","3-1g-2r.4.2","3-1g-2x.4.2","3-1e-2z.4.2","3-1e-2F.4.2","3-1y-2H.4.2","3-1y-2D.4.2","3-1z-2u.4.2","3-1z-30.4.2","3-1A-2Q.4.2","3-1A-28.4.2","3-1b-2W.4.2","3-1b-1H.4.2","3-o-1P.4.2","3-o-2M.4.2","3-q-2T.4.2","3-q-34.4.2","3-v-2J.4.2","3-v-2v.4.2","3-w-2C.4.2","3-w-2o.4.2","3-z-1E.4.2","3-z-37.4.2","3-B-2E.4.2","3-B-2B.4.2","3-k-2A.4.2","3-k-2y.4.2","3-6-2w.4.2","3-6-2t.4.2","3-9-2s.4.2","3-9-2p.4.2","3-b-2I.4.2","3-b-2L.4.2","3-f-35.4.2","3-f-32.4.2","3-h-31.4.2","3-h-2Y.4.2","3-U-2X.4.2","3-U-2U.4.2","3-19-2S.4.2","3-19-2P.4.2","3-16-2O.4.2","3-16-2n.4.2","3-14-2V.4.2","3-14-1V.4.2","3-11-1U.4.2","3-11-1S.4.2","3-Z-1Q.4.2","3-Z-1N.4.2","3-W-1X.4.2","3-W-1K.4.2","3-V-1I.4.2","3-V-1G.4.2","3-T-1F.4.2","3-T-1Z.4.2","3-Q-20.4.2","3-Q-2i.4.2","3-O-2g.4.2","3-O-2d.4.2","3-L-2c.4.2","3-L-29.4.2","3-J-27.4.2","3-J-24.4.2","3-G-23.4.2","3-G-2G.4.2","3-1c-3B.4.2","3-1c-39.4.2","3-H-4E.4.2","3-H-4D.4.2","3-I-4C.4.2","3-I-4B.4.2","3-K-4A.4.2","3-K-4z.4.2","3-M-4y.4.2","3-M-4x.4.2","3-N-4w.4.2","3-N-4v.4.2","3-P-4u.4.2","3-P-4t.4.2","3-R-4s.4.2","3-R-4F.4.2","3-S-4r.4.2","3-S-4p.4.2","3-5-4o.4.2","3-5-4m.4.2","3-1a-4l.4.2","3-1a-4k.4.2","3-X-4j.4.2","3-X-4i.4.2","3-Y-4h.4.2","3-Y-4g.4.2","3-10-4f.4.2","3-10-4e.4.2","3-12-4H.4.2","3-12-4q.4.2","3-13-4G.4.2","3-13-4U.4.2","3-15-4I.4.2","3-15-4Z.4.2","3-17-50.4.2","3-17-51.4.2","3-18-52.4.2","3-18-53.4.2","3-E-56.4.2","3-E-55.4.2","3-D-57.4.2","3-D-58.4.2","3-j-59.4.2","3-j-5a.4.2","3-g-5b.4.2","3-g-5c.4.2","3-d-4Y.4.2","3-d-54.4.2","3-c-4W.4.2","3-c-4V.4.2","3-a-4X.4.2","3-a-4T.4.2","3-8-4S.4.2","3-8-4R.4.2","3-7-4Q.4.2","3-7-4P.4.2","3-i-4O.4.2","3-i-4N.4.2","3-u-4M.4.2","3-u-4L.4.2","3-l-4K.4.2","3-l-4J.4.2","3-A-4c.4.2","3-A-4d.4.2","3-y-4a.4.2","3-y-49.4.2","3-x-4b.4.2","3-x-3A.4.2","3-C-3z.4.2","3-C-3y.4.2","3-t-3x.4.2","3-t-3w.4.2","3-r-3v.4.2","3-r-3u.4.2","3-p-3t.4.2","3-p-3s.4.2","3-n-3r.4.2","3-n-3q.4.2","3-F-3p.4.2","3-F-3C.4.2","3-1d-3o.4.2","3-1d-3m.4.2","3-1D-3l.4.2","3-1D-3k.4.2","3-1B-3j.4.2","3-1B-3i.4.2","3-1C-3h.4.2","3-1C-3g.4.2","3-1w-3f.4.2","3-1w-3e.4.2","3-1v-3d.4.2","3-1v-3c.4.2","3-1f-3b.4.2","3-1f-3a.4.2","3-1h-3n.4.2","3-1h-3D.4.2","3-1i-3E.4.2","3-1i-3F.4.2","3-1k-48.4.2","3-1k-47.4.2","3-1m-46.4.2","3-1m-45.4.2","3-1x-44.4.2","3-1x-43.4.2","3-1o-42.4.2","3-1o-41.4.2","3-1q-40.4.2","3-1q-3Z.4.2","3-3Y-3X.4.2"],"3W":3V,"3U":3T,"3S":"/3R/s/3Q/3P/3O/","3N":1,"3M":"","3L":3K,"3J":0,"3I":{"e":3H,"m":"3G"}}).38();'
但是,我不能定义这个字符串在 rust 像这样:
let a:&str = "5d.4n({"21":1u,"22":"25","26":"1u.2b","2l":2e,"2f":"2h","2j":["3-2k-2a.4.2","3-1t-1Y.4.2","3-1t-1J.4.2","3-1L-1M.4.2","3-1s-1O.4.2","3-1s-1R.4.2","3-1r-1T.4.2","3-1r-1W.4.2","3-1p-2m.4.2","3-1p-2N.4.2","3-1n-2R.4.2","3-1n-36.4.2","3-1l-2Z.4.2","3-1l-33.4.2","3-1j-2K.4.2","3-1j-2q.4.2","3-1g-2r.4.2","3-1g-2x.4.2","3-1e-2z.4.2","3-1e-2F.4.2","3-1y-2H.4.2","3-1y-2D.4.2","3-1z-2u.4.2","3-1z-30.4.2","3-1A-2Q.4.2","3-1A-28.4.2","3-1b-2W.4.2","3-1b-1H.4.2","3-o-1P.4.2","3-o-2M.4.2","3-q-2T.4.2","3-q-34.4.2","3-v-2J.4.2","3-v-2v.4.2","3-w-2C.4.2","3-w-2o.4.2","3-z-1E.4.2","3-z-37.4.2","3-B-2E.4.2","3-B-2B.4.2","3-k-2A.4.2","3-k-2y.4.2","3-6-2w.4.2","3-6-2t.4.2","3-9-2s.4.2","3-9-2p.4.2","3-b-2I.4.2","3-b-2L.4.2","3-f-35.4.2","3-f-32.4.2","3-h-31.4.2","3-h-2Y.4.2","3-U-2X.4.2","3-U-2U.4.2","3-19-2S.4.2","3-19-2P.4.2","3-16-2O.4.2","3-16-2n.4.2","3-14-2V.4.2","3-14-1V.4.2","3-11-1U.4.2","3-11-1S.4.2","3-Z-1Q.4.2","3-Z-1N.4.2","3-W-1X.4.2","3-W-1K.4.2","3-V-1I.4.2","3-V-1G.4.2","3-T-1F.4.2","3-T-1Z.4.2","3-Q-20.4.2","3-Q-2i.4.2","3-O-2g.4.2","3-O-2d.4.2","3-L-2c.4.2","3-L-29.4.2","3-J-27.4.2","3-J-24.4.2","3-G-23.4.2","3-G-2G.4.2","3-1c-3B.4.2","3-1c-39.4.2","3-H-4E.4.2","3-H-4D.4.2","3-I-4C.4.2","3-I-4B.4.2","3-K-4A.4.2","3-K-4z.4.2","3-M-4y.4.2","3-M-4x.4.2","3-N-4w.4.2","3-N-4v.4.2","3-P-4u.4.2","3-P-4t.4.2","3-R-4s.4.2","3-R-4F.4.2","3-S-4r.4.2","3-S-4p.4.2","3-5-4o.4.2","3-5-4m.4.2","3-1a-4l.4.2","3-1a-4k.4.2","3-X-4j.4.2","3-X-4i.4.2","3-Y-4h.4.2","3-Y-4g.4.2","3-10-4f.4.2","3-10-4e.4.2","3-12-4H.4.2","3-12-4q.4.2","3-13-4G.4.2","3-13-4U.4.2","3-15-4I.4.2","3-15-4Z.4.2","3-17-50.4.2","3-17-51.4.2","3-18-52.4.2","3-18-53.4.2","3-E-56.4.2","3-E-55.4.2","3-D-57.4.2","3-D-58.4.2","3-j-59.4.2","3-j-5a.4.2","3-g-5b.4.2","3-g-5c.4.2","3-d-4Y.4.2","3-d-54.4.2","3-c-4W.4.2","3-c-4V.4.2","3-a-4X.4.2","3-a-4T.4.2","3-8-4S.4.2","3-8-4R.4.2","3-7-4Q.4.2","3-7-4P.4.2","3-i-4O.4.2","3-i-4N.4.2","3-u-4M.4.2","3-u-4L.4.2","3-l-4K.4.2","3-l-4J.4.2","3-A-4c.4.2","3-A-4d.4.2","3-y-4a.4.2","3-y-49.4.2","3-x-4b.4.2","3-x-3A.4.2","3-C-3z.4.2","3-C-3y.4.2","3-t-3x.4.2","3-t-3w.4.2","3-r-3v.4.2","3-r-3u.4.2","3-p-3t.4.2","3-p-3s.4.2","3-n-3r.4.2","3-n-3q.4.2","3-F-3p.4.2","3-F-3C.4.2","3-1d-3o.4.2","3-1d-3m.4.2","3-1D-3l.4.2","3-1D-3k.4.2","3-1B-3j.4.2","3-1B-3i.4.2","3-1C-3h.4.2","3-1C-3g.4.2","3-1w-3f.4.2","3-1w-3e.4.2","3-1v-3d.4.2","3-1v-3c.4.2","3-1f-3b.4.2","3-1f-3a.4.2","3-1h-3n.4.2","3-1h-3D.4.2","3-1i-3E.4.2","3-1i-3F.4.2","3-1k-48.4.2","3-1k-47.4.2","3-1m-46.4.2","3-1m-45.4.2","3-1x-44.4.2","3-1x-43.4.2","3-1o-42.4.2","3-1o-41.4.2","3-1q-40.4.2","3-1q-3Z.4.2","3-3Y-3X.4.2"],"3W":3V,"3U":3T,"3S":"/3R/s/3Q/3P/3O/","3N":1,"3M":"","3L":3K,"3J":0,"3I":{"e":3H,"m":"3G"}}).38();"
如何在Rust中定义这个字符串?
1条答案
按热度按时间sqserrrh1#
您可以使用rust raw字符串,方法是在字符串前面加上
r#
并在后面加上#
,以便允许在字符串中使用引号,如str literals-and-escape文档中所述