-
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 #173 from darrell-roberts/swift-decorators-generics
Allow swift decorator constraints to apply to generics
- Loading branch information
Showing
4 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
17 changes: 17 additions & 0 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#[typeshare(swift = "Equatable")] | ||
pub struct Button<T> { | ||
/// Label of the button | ||
pub label: String, | ||
/// 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>, | ||
/// Button state | ||
pub state: ButtonState, | ||
/// Button Mode | ||
pub style: ButtonStyle, | ||
} |
28 changes: 28 additions & 0 deletions
28
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Foundation | ||
|
||
public struct Button<T: Codable & Equatable>: Codable, Equatable { | ||
/// Label of the button | ||
public let label: String | ||
/// Accessibility label if it needed to be different than label | ||
public let accessibility_label: String? | ||
/// Optional tooltips that provide extra explanation for a button | ||
public let tooltip: String? | ||
/// Button action if there one | ||
public let action: T? | ||
/// Icon if there is one | ||
public let icon: Icon? | ||
/// Button state | ||
public let state: ButtonState | ||
/// Button Mode | ||
public let style: ButtonStyle | ||
|
||
public init(label: String, accessibility_label: String?, tooltip: String?, action: T?, icon: Icon?, state: ButtonState, style: ButtonStyle) { | ||
self.label = label | ||
self.accessibility_label = accessibility_label | ||
self.tooltip = tooltip | ||
self.action = action | ||
self.icon = icon | ||
self.state = state | ||
self.style = style | ||
} | ||
} |
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