在Solana合约链实现IBC协议跨链互操作 - 苏胤榕
0 码力 | 29 页 | 3.05 MB | 1 年前3Comprehensive Rust(Ukrainian) 202412
88 15.4 Обмеження трейту . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 15.5 impl Trait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 15.6 dyn Trait . дозволяє пов’язувати функції з новими типами. Ви робите це за допомогою блоку impl: struct Race { name: String, laps: Vec, } impl Race { // Немає отримувача, статичний метод fn new(name: &str) -> Self використовувати назву структури. – Поясніть, що Self — це псевдонім типу для типу, до якого входить блок impl, і його можна використовувати деінде в блоці. – Зауважте, що self використовується, як і інші структури 0 码力 | 396 页 | 1.08 MB | 10 月前3Comprehensive Rust(Persian ) 202412
15.4 Trait Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 15.5 impl Trait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 15.6 dyn Trait . � � � � � . � � � � � � � � � � � � � � � � � � � � � � � impl � � � � � � � � � � � : struct Race } name: String , laps: Vecimpl Race } / / No receiver, a static method fn new(name: &str) � � . – � � � � � � � � � � � Self � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � impl � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � . – Note 0 码力 | 393 页 | 987.97 KB | 10 月前3Comprehensive Rust ?
15.4 Trait Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 15.5 impl Trait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 15.6 dyn Trait . you to associate functions with your new types. You do this with an impl block: struct Race { name: String, laps: Vec, } impl Race { // No receiver, a static method fn new(name: &str) -> Self show how the struct name could also be used. – Explain that Self is a type alias for the type the impl block is in and can be used elsewhere in the block. – Note how self is used like other structs and 0 码力 | 378 页 | 1009.46 KB | 1 年前3Comprehensive Rust(English) 202412
15.4 Trait Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 15.5 impl Trait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 15.6 dyn Trait . you to associate functions with your new types. You do this with an impl block: struct Race { name: String, laps: Vec, } impl Race { // No receiver, a static method fn new(name: &str) -> Self show how the struct name could also be used. – Explain that Self is a type alias for the type the impl block is in and can be used elsewhere in the block. – Note how self is used like other structs and 0 码力 | 382 页 | 1.00 MB | 10 月前3Comprehensive Rust(简体中文) 202412
75 14.4 特征边界 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 14.5 impl Trait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 14.6 练习:通用 min 函数 派生特征 3 minutes 练习:通用日志 20 minutes 13.1 方法 Rust 允许您将函数与新类型相关联。您可以使用“impl”块来执行此操作: struct Race { name: String, laps: Vec, } impl Race { // No receiver, a static method fn new(name: &str) -> Self 们可以将所有实现代码保存在一个可预测的位置。 • 指出关键字“self”的用法,它是一种方法接收器。 – 显示它是“self: Self”的缩写术语,或许要显示结构体名称的可能用法。 – 说明“Self”是“impl”块所属类型的类型别名,可以在块中的其他位置使用。 – 指出“self”的使用方式与其他结构体一样,并且可以使用点表示法来指代各个字段。 – This might be a good time to 0 码力 | 359 页 | 1.33 MB | 10 月前3Comprehensive Rust(Español) 202412
15.4 Trait Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 15.5 impl Trait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 15.6 dyn Trait . permite asociar funciones a los nuevos tipos. Para ello, usa un bloque impl: struct Race { name: String, laps: Vec, } impl Race { // No hay receptor, método estático fn new(name: &str) -> Self nombre de la estructura. – Explica que Self es un tipo de alias para el tipo en el que está el bloque impl y que se puede usar en cualquier parte del bloque. – Ten en cuenta que se puede usar self como otras 0 码力 | 389 页 | 1.04 MB | 10 月前3Comprehensive Rust(Português do Brasil) 202412
85 15.4 Trait Bounds (Limites de Trait) . . . . . . . . . . . . . . . . . . . . . . . . . 86 15.5 impl Trait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 15.6 dyn Trait . valor do tipo Newtons acessando o campo único no newtype. – Geralmente, Rust não gosta de coisas implícitas, como unwrapping automático ou, por exemplo, usar booleanos como inteiros. – Sobrecarga de você associe funções aos seus novos tipos. Você faz isso com um bloco impl: struct Race { name: String, laps: Vec, } impl Race { // Sem receptor, um método estático fn new(name: &str) -> Self 0 码力 | 389 页 | 1.05 MB | 10 月前3Comprehensive Rust(繁体中文)
74 14.3 特徵界限 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 14.4 impl Trait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 14.5 練習:泛型 min . minutes 練習:泛型 Logger 20 minutes 13.1 方法 Rust 可讓您將函式與新型別建立關聯。您可以使用 impl 區塊來執行這項操作: struct Race { name: String, laps: Vec, } impl Race { // No receiver, a static method fn new(name: &str) -> Self 用方法,我們可以將所有實作程式碼存放在可預測的位置。 • 指出我們會使用關鍵字 self,也就是方法接收器。 – 說明 self 是 self: Self 的縮寫,或許也能示範結構體名稱的可能用法。 – 講解 Self 是 impl 區塊所屬型別的型別別名,可用於該區塊的其他位置。 – 提醒學員如何以類似於其他結構體的方式來使用 self,並指出點標記法可用來參照個別欄 位, – This might be a good time 0 码力 | 358 页 | 1.41 MB | 10 月前3Comprehensive Rust(繁体中文) 202406
72 14.3 特徵界限 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 14.4 impl Trait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 14.5 練習:泛型 min . minutes 練習:泛型 Logger 20 minutes 13.1 方法 Rust 可讓您將函式與新型別建立關聯。您可以使用 impl 區塊來執行這項操作: struct Race { name: String, laps: Vec, } impl Race { // No receiver, a static method fn new(name: &str) -> Self 用方法,我們可以將所有實作程式碼存放在可預測的位置。 • 指出我們會使用關鍵字 self,也就是方法接收器。 – 說明 self 是 self: Self 的縮寫,或許也能示範結構體名稱的可能用法。 – 講解 Self 是 impl 區塊所屬型別的型別別名,可用於該區塊的其他位置。 – 提醒學員如何以類似於其他結構體的方式來使用 self,並指出點標記法可用來參照個別欄 位, – This might be a good time 0 码力 | 356 页 | 1.41 MB | 1 年前3
共 756 条
- 1
- 2
- 3
- 4
- 5
- 6
- 76