-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a580aea
commit acfe569
Showing
9 changed files
with
94 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,12 @@ jobs: | |
- run: mdbook build -d book | ||
working-directory: ./ | ||
|
||
- name: Link Checker | ||
uses: lycheeverse/[email protected] | ||
with: | ||
args: book | ||
fail: true | ||
|
||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
# Only deploy when ref is next | ||
|
@@ -60,4 +66,5 @@ jobs: | |
- uses: codespell-project/actions-codespell@master | ||
with: | ||
check_filenames: true | ||
path: src | ||
ignore_words_list: crate,statics,relm |
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
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,65 @@ | ||
# Migration from v0.6 to v0.7 | ||
|
||
## Factory changes | ||
|
||
`ParentInput` and `forward_to_parent()` were removed from `FactoryComponent` and `AsyncFactoryComponent`. | ||
Instead, factories now support basically the same builder pattern as components. | ||
|
||
### Example | ||
|
||
Replace this: | ||
|
||
```rust | ||
#[relm4::factory] | ||
impl FactoryComponent for Counter { | ||
type ParentInput = AppMsg; | ||
|
||
fn forward_to_parent(output: Self::Output) -> Option<AppMsg> { | ||
Some(match output { | ||
CounterOutput::SendFront(index) => AppMsg::SendFront(index), | ||
CounterOutput::MoveUp(index) => AppMsg::MoveUp(index), | ||
CounterOutput::MoveDown(index) => AppMsg::MoveDown(index), | ||
}) | ||
} | ||
|
||
// ... | ||
} | ||
|
||
#[relm4::component] | ||
impl SimpleComponent for App { | ||
// ... | ||
|
||
fn init( | ||
counter: Self::Init, | ||
root: &Self::Root, | ||
sender: ComponentSender<Self>, | ||
) -> ComponentParts<Self> { | ||
let counters = FactoryVecDeque::new(gtk::Box::default(), sender.input_sender()); | ||
// ... | ||
} | ||
} | ||
``` | ||
|
||
With this: | ||
|
||
```rust | ||
#[relm4::component] | ||
impl SimpleComponent for App { | ||
// ... | ||
|
||
fn init( | ||
counter: Self::Init, | ||
root: &Self::Root, | ||
sender: ComponentSender<Self>, | ||
) -> ComponentParts<Self> { | ||
let counters = FactoryVecDeque::builder() | ||
.launch(gtk::Box::default()) | ||
.forward(sender.input_sender(), |output| match output { | ||
CounterOutput::SendFront(index) => AppMsg::SendFront(index), | ||
CounterOutput::MoveUp(index) => AppMsg::MoveUp(index), | ||
CounterOutput::MoveDown(index) => AppMsg::MoveDown(index), | ||
}); | ||
// ... | ||
} | ||
} | ||
``` |