Skip to content

Commit 26bc7a4

Browse files
committed
bookmarks as slice
1 parent bac5a9a commit 26bc7a4

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

examples/basic_browser.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ fn run() -> (BasicBrowser, Task<Message>) {
88
BasicBrowser::new_basic()
99
.with_tab_bar()
1010
.with_nav_bar()
11-
.with_bookmark_bar(vec![Bookmark::new(
12-
"https://www.rust-lang.org",
13-
"rust-lang.org",
14-
)])
11+
.with_bookmark_bar(&[Bookmark::new("https://www.rust-lang.org", "rust-lang.org")])
1512
.build(),
1613
Task::none(),
1714
)

examples/keyboard_driven.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl Default for Browser {
5050
let widgets = BrowserWidget::new_basic()
5151
.with_custom_shortcuts(shortcuts)
5252
.with_tab_bar()
53-
.with_bookmark_bar(vec![
53+
.with_bookmark_bar(&[
5454
Bookmark::new("https://www.rust-lang.org", "rust-lang.org"),
5555
Bookmark::new(
5656
"https://github.com/LegitCamper/icy_browser",

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ fn to_url(url: &str) -> Option<Url> {
9898
}
9999
}
100100

101+
#[derive(Debug, Clone)]
101102
pub struct Bookmark {
102103
url: Url,
103104
name: String,

src/widgets/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ where
172172
self
173173
}
174174

175-
pub fn with_bookmark_bar(mut self, bookmarks: Vec<Bookmark>) -> Self {
176-
self.bookmarks = Some(bookmarks);
175+
pub fn with_bookmark_bar(mut self, bookmarks: &[Bookmark]) -> Self {
176+
self.bookmarks = Some(bookmarks.to_vec());
177177
self
178178
}
179179

0 commit comments

Comments
 (0)