-
Notifications
You must be signed in to change notification settings - Fork 5
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
1cc3883
commit 872de44
Showing
4 changed files
with
108 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ mod github; | |
mod quest; | ||
mod stage; | ||
mod ui; | ||
mod utils; | ||
|
||
fn main() { | ||
ui::launch(); | ||
|
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,14 @@ | ||
use std::ops::Range; | ||
|
||
pub fn replace_many_ranges( | ||
s: &mut String, | ||
ranges: impl IntoIterator<Item = (Range<usize>, impl AsRef<str>)>, | ||
) { | ||
let ranges = ranges.into_iter().collect::<Vec<_>>(); | ||
if !ranges.is_empty() { | ||
debug_assert!((0..ranges.len() - 1).all(|i| ranges[i].0.end <= ranges[i + 1].0.start)); | ||
for (range, content) in ranges.into_iter().rev() { | ||
s.replace_range(range, content.as_ref()); | ||
} | ||
} | ||
} |