-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace all
Self
identifiers in method argument and return types (#…
…4155) Co-authored-by: Oliver T <[email protected]>
- Loading branch information
1 parent
02679e1
commit 0e89a29
Showing
5 changed files
with
64 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//! This tests that the `wasm_bindgen` macro produces code that compiles for these use cases. | ||
//! `cargo test --target wasm32-unknown-unknown` will not run if any of these tests breaks. | ||
use wasm_bindgen::prelude::*; | ||
|
||
#[wasm_bindgen] | ||
pub struct A; | ||
|
||
#[wasm_bindgen] | ||
pub struct SelfPortrait; | ||
|
||
#[wasm_bindgen] | ||
impl A { | ||
pub fn test_only_self() -> Self { | ||
A | ||
} | ||
pub fn test_option_self() -> Option<Self> { | ||
None | ||
} | ||
pub fn test_nested_self() -> Result<Option<Self>, String> { | ||
Ok(None) | ||
} | ||
pub fn test_self_slice() -> Box<[Self]> { | ||
Box::new([]) | ||
} | ||
pub fn test_selfish() -> Result<Self, SelfPortrait> { | ||
Ok(A) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters