Tsatsa, shigar da wannan yaren shirye-shiryen akan Ubuntu 18.04

game da Tsatsa

A makala ta gaba zamuyi duba ne akan yadda ake girka yaren Tsatsa. Hakanan zamu ga yadda ake tattarawa da gudanar da aikace-aikace na asali tare da Tsatsa. Wannan harshe ne na hada-hada, manufa mai manufa wanda ake yi ci gaba da Mozilla. A cewar masu haɓaka ta, an tsara ta don ta kasance «harshe mai aminci da amfani«. Yana tallafawa tsarkakakken aiki, aiwatarwa, tilas, da kuma shirye-shiryen daidaitaccen abu.

Tsatsa yaren shirye-shirye ne wanda yake sabo. Yayi alƙawarin ƙirƙirar aikace-aikace masu sauri da amintattu. Kamfanoni kamar Atlassian, Chef, CoreOS, da DropBox suna amfani da Tsatsa. Game da manufofin Mozilla, An haɓaka tsatsa ta hanyar buɗe hanya gaba ɗaya da neman shigar da bayanai daga al'umma.

Babban burin tsatsa shine ya zama kyakkyawan harshe don ƙirƙirar manyan shirye-shirye, abokin ciniki da gefen uwar garke, wanda ke gudana akan Intanet. Wannan ya sanya girmamawa ta musamman kan tsaro da sarrafa rarraba ƙwaƙwalwa. Aikin haruffa na wannan harshe yayi kama da na C da C ++, tare da maɓallin keɓaɓɓun maɓallan lamba da tsarin sarrafa kwarara kamar if, kuma, do, yayin da y domin.

An tsabtace ƙirar harshe ta hanyar gogewa a cikin haɓakar Rust mai tarawa kanta da injin Tsatsa. servo navigator. Kodayake hakan ne ci gaba da ɗaukar nauyin Mozilla da Samsung, da'awar zama aikin al'umma. Babban ci gaban ya fito ne daga membobin al'umma.

Idan wani yana buƙatar ƙarin bayani game da wannan yaren, za su iya tuntuɓar yawancin takaddun da ke akwai game da shi. Zamu iya samun su akan gidan yanar gizon su daga littafi mai mahimmanci game da Tsatsa Ga takaddun hukuma.

Shigar da Tsatsa akan Ubuntu 18.04

Wannan harshen shirye-shiryen ana iya sanya shi ta hanya mai sauƙi. Ya isa tare yi amfani da curl. Idan ba mu sanya shi ba, za mu iya riƙe shi ta hanyar bugawa a cikin tashar (Ctrl + Alt T):

sudo apt update && sudo apt install curl

Da zarar mun sanya curl, za mu iya ƙaddamar da shigarwa. Don wannan mun rubuta a cikin wannan tashar:

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

Yayin shigarwa za mu ga wani abu kamar abin da za a iya gani a cikin hoto mai zuwa.

Menu yayin shigar tsatsa

A wannan lokacin, zai zama dole latsa 1 don ci gaba da girkawa. Bayan an gama girkawa, za mu ga sakon da muke bukata saita yanayi don tafiyar da mai tsatsa. Za mu warware wannan ta buga a cikin tashar:

source $HOME/.cargo/env

Wannan umarnin ba zai nuna mana komai ba, amma duk da wannan, za mu iya tabbatar da hakan muhallinmu a shirye yake don fara tattara shirye-shiryen Tsatsa. Dole ne muyi haka sau ɗaya kawai. Lokaci na gaba da ka shiga cikin tashar, zai ɗora kai tsaye.

A lokacin shigarwar da ta gabata, za a shigar da fakiti da yawa:

  • kaya - Manajan kunshin da Rust yayi amfani da shi.
  • tsatsa - Mai tattara tsatsa na yanzu.
  • rutu - Mai saka tsatsa wanda aka zazzage kuma ya gudana.

Kodayake an girka su daidai, amma dole ne in sanya gcc compiler ya fi girma don daidaitaccen aiki.

Samfurin aikace-aikace tare da Tsatsa

Misalin aikace-aikace da aka yi da Tsatsa

Bayan an gama girka, lokaci yayi da za'a gwada shi. Don haka zamu rubuta tsarin yau da kullun don farawa da kowane yare. Mun buɗe editan da muke so kuma muka ƙirƙiri fayil mai zuwa:

sudo nano ejemplo.rs

A cikin editan mun liƙa waɗannan layuka masu zuwa:

// La aplicación más básica

fn main() {
         println!("Aplicación básica de Rust");
         println!("***Ubunlog***");
}

Ba zan fadi abin da kowane layi yake nufi ba, amma ya kamata ya zama a bayyane yake cewa zai buga wasu layi biyu na rubutu. Idan kuna sha'awa duba karin Tsatsan misalai, zaka iya tuntuɓar Misalan takaddara by Tsakar Gida

Da zarar an adana fayil ɗin, a wannan yanayin tare da sunan misali .rs, mun riga mun sami fayil ɗin asalinmu. Yanzu zamu iya tattara shi don ƙirƙirar aiwatarwa:

rustc ejemplo.rs

Idan komai ya tafi daidai zamu ga cewa tashar ba zata nuna mana komai ba. Idan akwai kuskure, zaku ga sako game da shi.

Barka dai aikace-aikacen duniya da aka yi da Tsatsa

Kamar yadda zamu iya gani a cikin hoton, an kirkiro fayil mai zartarwa, wanda yake da suna iri ɗaya da fayil ɗin tushe. Ana iya gudanar da wannan don ganin aikace-aikacen samfurinmu:

./ejemplo

Abubuwan da ke cikin labarin suna bin ka'idodinmu na ka'idojin edita. Don yin rahoton kuskure danna a nan.

Kasance na farko don yin sharhi

Bar tsokaci

Your email address ba za a buga.

*

*

  1. Mai alhakin bayanan: Miguel Ángel Gatón
  2. Dalilin bayanan: Gudanar da SPAM, gudanar da sharhi.
  3. Halacci: Yarda da yarda
  4. Sadarwar bayanan: Ba za a sanar da wasu bayanan ga wasu kamfanoni ba sai ta hanyar wajibcin doka.
  5. Ajiye bayanai: Bayanin yanar gizo wanda Occentus Networks (EU) suka dauki nauyi
  6. Hakkoki: A kowane lokaci zaka iyakance, dawo da share bayanan ka.