You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 30, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: it-IT/faq.md
+38-33Lines changed: 38 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -798,73 +798,78 @@ Sono basati su una serie di articoli accademici che possono essere trovati nel [
798
798
Perché la sintassi dei campi di esistenza é fatta cosí?
799
799
</a></h3>
800
800
801
-
The `'a` syntax comes from the ML family of programming languages, where `'a` is used to indicate a generic type parameter. For Rust, the syntax had to be something that was unambiguous, noticeable, and fit nicely in a type declaration right alongside traits and references. Alternative syntaxes have been discussed, but no alternative syntax has been demonstrated to be clearly better.
801
+
La sintassi `'a` proviene dalla famiglia ML di linguaggi di programmazione, dove `'a` viene utilizzato per indicare un parametro di tipo generico.
802
+
In Rust, la sintassi doveva rappresentare qualcosa di univoco, chiaramente visibile e integrato con le altre dichiarazioni dei tipi insieme ai vari tratti e riferimenti.
803
+
Sono state prese in considerazione anche altre scelte ma nessuna sintassi alternativa si é dimostrata chiaramente migliore.
- Each elided lifetime in a function’s arguments becomes a distinct lifetime parameter.
847
-
- If there is exactly one input lifetime, elided or not, that
848
-
lifetime is assigned to all elided lifetimes in the return values
849
-
of that function.
850
-
- If there are multiple input lifetimes, but one of them is &self
851
-
or &mut self, the lifetime of self is assigned to all elided
852
-
output lifetimes.
853
-
3. Finally, in a `struct` or `enum` definition, all lifetimes must be explicitly declared.
844
+
1. Nel corpo di una funzione non devi mai specificare un campo di esistenza esplicitamente;
845
+
il valore corretto dovrebbe essere sempre dedotto correttamente.
846
+
2. Nella *dichiarazione* di una funzione (ad esempio, nei tipi dei suoi parametri
847
+
o il suo tipo di ritorno), *potresti* dover specificare un campo di esistenza manualmente.
848
+
I campi di esistenza in questo contesto utilizzano un semplice metodo chiamato
849
+
["elisione del campo di esistenza"](https://doc.rust-lang.org/book/lifetimes.html#lifetime-elision),
850
+
che a sua volta consiste in queste tre regole:
851
+
- Ciascun campo di esistenza eliso nei parametri di una funzione diviene un campo di esistenza distinto.
852
+
- Se vi é esattamente un singolo campo di esistenza in ingresso, eliso o no, quel campo di esistenza
853
+
viene assegnato a tutti i campi di esistenza elisi utilizzati per i valori di ritorno di quella funzione.
854
+
- Se ci sono piú campi di esistenza in ingresso ma uno di quelli é un `&self` o un `&mut self`, il campo di esistenza
855
+
di `self` viene assegnato a tutti i campi di esistenza di uscita.
856
+
3. Se si sta definendo una `struct` o `enum` i campi di esistenza sono da dichiarare espressamente.
854
857
855
-
If these rules result in compilation errors, the Rust compiler will provide an error message indicating the error caused, and suggesting a potential solution based on which step of the inference process caused the error.
858
+
Se queste regole danno origine a un errore di compilazione, il compilatore di Rust fornirá un messaggio di errore indicante l'errore e anche una potenziale soluzione basata sugli algoritmi di deduzione.
Come puó Rust garantire l'assenza di "puntatori nulli" e "puntatori sospesi"?
859
862
</a></h3>
860
863
861
-
The only way to construct a value of type `&Foo` or `&mut Foo` is to specify an existing value of type `Foo` that the reference points to. The reference "borrows" the original value for a given region of code (the lifetime of the reference), and the value being borrowed from cannot be moved or destroyed for the duration of the borrow.
864
+
L'unico modo di creare un valore `&Cosa` or `&mut Cosa` é di specificare un valore preesistente di tipo `Coso` a cui la referenza deve fare riferimento.
865
+
Il riferimento in questo modo ottiene in prestito il valore originale per un determinato blocco di codice(il campo di esistenza del riferimento) e il valore prestato non puó essere spostato o distrutto per tutta la durata del prestito.
Come faccio a indicare l'assenza di un valore senza utilizzare <code>null</code>?
865
869
</a></h3>
866
870
867
-
You can do that with the [`Option`][Option] type, which can either be `Some(T)` or `None`. `Some(T)` indicates that a value of type `T` is contained within, while `None` indicates the absence of a value.
871
+
Puoi fare ció con il tipo [`Option`][Option] che puó alternativamente essere `Some(T)` o `None`.
872
+
`Some(T)` indica che un valore di tipo `T` é contenuto all'interno, mentre `None` ne indica l'assenza.
0 commit comments