코딩Coding/★Rust★기초★Syntax
-
Rust-How do I disambiguate associated types?코딩Coding/★Rust★기초★Syntax 2023. 10. 3. 10:35
How do I disambiguate associated types? How do I disambiguate associated types? My current code looks like this: pub trait A {} pub trait HasA { type A: A; fn gimme_a() -> Self::A; } pub trait RichA: A {} pub trait RichHasA: HasA { type A: RichA; fn gimme_... stackoverflow.com
-
Rust❤️Implementing Deserialize코딩Coding/★Rust★기초★Syntax 2023. 9. 30. 15:39
Implementing Deserialize https://serde.rs/impl-deserialize.htmlImplementing Deserialize · SerdeImplementing Deserialize The Deserialize trait looks like this: pub trait Deserialize; } This method's job is to map the type into the Serde data model by providing the Desserde.rs
-
destructure a tuple value코딩Coding/★Rust★기초★Syntax 2023. 9. 29. 12:39
fn main() { let tup = (500, 6.4, 1); let (x, y, z) = tup; println!("The value of y is: {y}"); } https://doc.rust-lang.org/book/ch03-02-data-types.htmlData Types - The Rust Programming LanguageEvery value in Rust is of a certain data type, which tells Rust what kind of data is being specified so it knows how to work with that data. We’ll look at two data type subsets: scalar and compound. Keep in..