Skip to content

Commit

Permalink
bookmarks as slice
Browse files Browse the repository at this point in the history
  • Loading branch information
LegitCamper committed Oct 3, 2024
1 parent bac5a9a commit 26bc7a4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
5 changes: 1 addition & 4 deletions examples/basic_browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ fn run() -> (BasicBrowser, Task<Message>) {
BasicBrowser::new_basic()
.with_tab_bar()
.with_nav_bar()
.with_bookmark_bar(vec![Bookmark::new(
"https://www.rust-lang.org",
"rust-lang.org",
)])
.with_bookmark_bar(&[Bookmark::new("https://www.rust-lang.org", "rust-lang.org")])
.build(),
Task::none(),
)
Expand Down
2 changes: 1 addition & 1 deletion examples/keyboard_driven.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Default for Browser {
let widgets = BrowserWidget::new_basic()
.with_custom_shortcuts(shortcuts)
.with_tab_bar()
.with_bookmark_bar(vec![
.with_bookmark_bar(&[
Bookmark::new("https://www.rust-lang.org", "rust-lang.org"),
Bookmark::new(
"https://github.com/LegitCamper/icy_browser",
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ fn to_url(url: &str) -> Option<Url> {
}
}

#[derive(Debug, Clone)]
pub struct Bookmark {
url: Url,
name: String,
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ where
self
}

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

Expand Down

0 comments on commit 26bc7a4

Please sign in to comment.