I-Rust 1.43, inguqulo encane ehlanganisa kuphela izibuyekezo nokulungiswa

Ithimba leRust limemezele ukutholakala kwe inguqulo entsha yolimi lwakho lokuhlela Ukugqwala 1.43. Le nguqulo entsha ayilethi izici ezintsha ezibalulekile futhi kubhekwa njengenguqulo encane. Yize kugqame ukuthi lapho ama-API amasha azinzile, ukuthuthukiswa kokusebenza kokuhlanganiswa nokusebenza okuncane kwe-macro.

Kulabo abangazi ngeRust kufanele bakwazi lokho lolu wulimi lohlelo olugxile ekusebenzeni okuphephile ngememori, inikeza ukuphathwa kwememori okuzenzakalelayo futhi ihlinzeka ngezindlela zokuzuza ukuvumelana okuphezulu kwemisebenzi, ngaphandle kokusebenzisa umqoqi kadoti nesikhathi sokusebenza.

Ukuphathwa kwememori okuzenzakalelayo ku Ukugqwala kuvimbela unjiniyela ekuphazamiseni izikhombisi futhi kuvikela ezinkingeni ezivela emsebenzini wezinga eliphansi ngememorinjengokufinyelela endaweni yememori ngemuva kokuyikhulula, ukukhomba izikhombisi-ndlela ezingekho, ukuphuma kwemingcele ye-buffer, njll.

Ukusabalalisa imitapo yolwazi, ukuqinisekisa ukuhlangana nokuphatha ukuncika kwephrojekthi, umphathi weCargo package uyakhiwa, okukuvumela ukuthi uthole imitapo yolwazi oyidingayo yohlelo ngokuchofoza okukodwa. Indawo yokugcina yama-crates.io isekelwa ukusingathwa kwemitapo yolwazi.

Yini okusha kuRust 1.43?

Phakathi kwezici ezintsha zikaRust 1.43, okubaluleke kakhulu okugqanyiswe yithimba elisekela ulimi lohlelo yi ukuzinza kwama-API amasha ayisithupha, kanye nokwenza ngcono okwenziwe ekusebenzeni kweClippy. 

Okwezinguquko ezigqamile kule nguqulo entsha yilezi kuma-macros, njengoba manje kungenzeka ukusebenzisa amazwibela wezinto ukuwaguqula abe yikhodi yokuziphatha, ukwenziwa (impl) noma amabhlogo angaphandle.

Futhi, kuRust 1.43 ukuthayipha ukuthayipha okuzungezile kuthuthukisiwe, izinkomba kanambambili nokusebenza. Kule nguqulo entsha, kunokuhlukahluka okusha kwemvelo yokulayisha yokuhlola.

Ukwenza lula ukuhlolwa kokuhlanganiswa, iCargo izocacisa ukuguquguquka kwemvelo okusha. Isibonelo, lapho sisebenza kuphrojekthi yomugqa womyalo, obizwa nje nge- "ehl", uma sibhala isivivinyo sokuhlanganisa, sifuna ukucela le-binary kanambambili bese sibona ukuthi yenzani, lapho kwenziwa izivivinyo namabhentshimakhi.

Manje kungenzeka ukusebenzisa izakhi ezihambisanayo kuma-floats nezinombolo ngqo, esikhundleni sokungenisa imodyuli. Ngamanye amagama, manje usungabhala u32 :: MAX kanye f32 :: NAN engasetshenziswanga "Sebenzisa i-std :: u32 noma" sebenzisa i-std :: f32 "

Futhi, kunemodyuli entsha ekhipha kabusha izinhlobo zasendulo. Lokhu kungaba wusizo lapho ubhala imacro futhi ufuna ukuqinisekisa ukuthi izinhlobo azifihliwe.

Kwezinye izinguquko ezethulwayo:

  • Ukungezwa kwemvelo okusha kwe-CARGO_BIN_EXE_ {name} kungeziwe ku-Cargo, kusethwe ngesikhathi sokwakhiwa kwezivivinyo zokuhlanganisa futhi okuvumela ukunquma indlela ephelele efayeleni elisebenzisekayo elichazwe esigabeni se - "[[bin]]" sephakheji.
  • Izinkulumo "Uma" zivumela ukusetshenziswa kwezimpawu ezifana ne - "# [cfg ()]".
  • Ingxenye entsha ye-API idluliselwe esigabeni esizinzile

Ukufaka iRust kuLinux

Si ufuna ukufaka lolu limi lohlelo kusistimu yakho, Singakwenza ngokulanda isifaki esizosisiza ukuthi sithole ukugqwala kusistimu yethu

Vele uvule ukuphela bese usebenzisa kuso:

curl https://sh.rustup.rs -sSf | sh

Lapho usebenzisa lo myalo isifaki sizolandwa futhi sizosebenza cishe ngokushesha, Udinga ukucindezela u-1 ukuze uqhubeke nokufakwa ngamanani azenzakalelayo futhi izolanda wonke amaphakheji adingekayo.

Uma ufuna ukufakwa ngokwezifiso, kufanele uthayiphe u-2 futhi uzochaza okuguquguqukayo kwemvelo yakho phakathi kwezinye izinto.

Ekupheleni kokufakwa kweRust ohlelweni lwethu, umkhombandlela weCargo bin uzongezwa ngokushesha kule ndlela elandelayo ( ~ / .cargo / bin) lapho wonke amathuluzi efakiwe) ku-PATH yakho eguquguqukayo yemvelo, ku ~ / .profile.

Kwenziwe lokhu kufanele siqhubeke ukulungisa i-ShellLokhu sikwenza ngokuguqula ifayela le- ~ / .profile ukuze sisebenzise i-PATH eguquliwe ukusebenza nemvelo yeRust, sisebenzisa le miyalo ku-terminal:

source ~/.profile
source ~/.cargo/env

Manje kuphela kumele siqhubeke nokuqinisekisa ukuthi iRust ifakwe kahle ohlelweni lwethu, senza lokhu ngokuthayipha umyalo olandelayo ku-terminal

rustc --version

Futhi ngayo kufanele sithole inguqulo yeRust esibukweni esikufake ohlelweni lwethu.

Futhi-ke, singaqala ukusebenzisa lolu limi futhi sikwazi ukufaka izinhlelo zokusebenza ezilusebenzisa ohlelweni lwethu.


Okuqukethwe yi-athikili kunamathela ezimisweni zethu ze izimiso zokuhlelela. Ukubika iphutha chofoza lapha.

Yiba ngowokuqala ukuphawula

Shiya umbono wakho

Ikheli lakho le ngeke ishicilelwe.

*

*

  1. Ubhekele imininingwane: Miguel Ángel Gatón
  2. Inhloso yedatha: Lawula Ugaxekile, ukuphathwa kwamazwana.
  3. Ukusemthethweni: Imvume yakho
  4. Ukuxhumana kwemininingwane: Imininingwane ngeke idluliselwe kubantu besithathu ngaphandle kwesibopho esisemthethweni.
  5. Isitoreji sedatha: Idatabase ebanjwe yi-Occentus Networks (EU)
  6. Amalungelo: Nganoma yisiphi isikhathi ungakhawulela, uthole futhi ususe imininingwane yakho.

i-bool(iqiniso)