-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from darrell-roberts/swift-generic-constraints-2
allow defining generic type constraints for swift
- Loading branch information
Showing
11 changed files
with
214 additions
and
154 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
17 changes: 13 additions & 4 deletions
17
core/data/tests/generic_struct_with_constraints_and_decorators/input.rs
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 |
---|---|---|
@@ -1,17 +1,26 @@ | ||
#[typeshare(swift = "Equatable")] | ||
pub struct Button<T> { | ||
#[typeshare( | ||
swift = "Equatable, Identifiable", | ||
swiftGenericConstraints = "T: Equatable & SomeThingElse, V: Equatable" | ||
)] | ||
pub struct Button<T, V, I> { | ||
/// Label of the button | ||
pub label: String, | ||
pub label: I, | ||
/// Accessibility label if it needed to be different than label | ||
pub accessibility_label: Option<String>, | ||
/// Optional tooltips that provide extra explanation for a button | ||
pub tooltip: Option<String>, | ||
/// Button action if there one | ||
pub action: Option<T>, | ||
/// Icon if there is one | ||
pub icon: Option<Icon>, | ||
pub icon: Option<V>, | ||
/// Button state | ||
pub state: ButtonState, | ||
/// Button Mode | ||
pub style: ButtonStyle, | ||
} | ||
|
||
#[typeshare] | ||
pub struct ButtonState; | ||
|
||
#[typeshare] | ||
pub struct ButtonStyle; |
16 changes: 12 additions & 4 deletions
16
core/data/tests/generic_struct_with_constraints_and_decorators/output.swift
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
Oops, something went wrong.