2015-01-17 13 views

risposta

15

si utilizza il metodo to_string():

'c'.to_string() 
+2

Hm, che è divertente. Ho cercato l'API di Rust per 'to_string' ma non ho trovato nessun implementatore su questo metodo. Potresti pubblicare un link alla sua API. Per completezza '^ _ ^'! –

+1

@DanielFath: stai cercando ['std :: string :: ToString :: to_string'] (http://doc.rust-lang.org/std/string/trait.ToString.html#tymethod.to_string) , che ha un impl di coperta per 'T: String', che implementa' char'. –

+0

Oh, ecco come funziona. Pensavo che 'String' fosse un buffer come struttura, mentre in realtà è un tratto. Hmm ... –

Problemi correlati