mirror of
https://github.com/Drop-OSS/wry-cef.git
synced 2026-01-30 20:55:24 +01:00
refactor!: rename builder methods for clarity and consistency (#1558)
This commit is contained in:
8
.changes/builder-naming.md
Normal file
8
.changes/builder-naming.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
"wry": "minor:breaking"
|
||||
---
|
||||
|
||||
Rename `WebViewBuilder` methods for consistency and clarity:
|
||||
|
||||
- Renamed `WebViewBuilder::with_web_context` to `WebViewBuilder::new_with_web_context`
|
||||
- Renamed `WebViewBuilder::with_attributes` to `WebViewBuilder::new_with_attributes`
|
||||
@@ -768,7 +768,7 @@ impl<'a> WebViewBuilder<'a> {
|
||||
}
|
||||
|
||||
/// Create a new [`WebViewBuilder`] with a web context that can be shared with multiple [`WebView`]s.
|
||||
pub fn with_web_context(web_context: &'a mut WebContext) -> Self {
|
||||
pub fn new_with_web_context(web_context: &'a mut WebContext) -> Self {
|
||||
let attrs = WebViewAttributes {
|
||||
context: Some(web_context),
|
||||
..Default::default()
|
||||
@@ -783,7 +783,7 @@ impl<'a> WebViewBuilder<'a> {
|
||||
}
|
||||
|
||||
/// Create a new [`WebViewBuilder`] with the given [`WebViewAttributes`]
|
||||
pub fn with_attributes(attrs: WebViewAttributes<'a>) -> Self {
|
||||
pub fn new_with_attributes(attrs: WebViewAttributes<'a>) -> Self {
|
||||
Self {
|
||||
attrs,
|
||||
#[allow(clippy::default_constructed_unit_structs)]
|
||||
@@ -1756,7 +1756,7 @@ impl WebView {
|
||||
/// - Panics if the provided handle was not supported or invalid.
|
||||
/// - Panics on Linux, if [`gtk::init`] was not called in this thread.
|
||||
pub fn new(window: &impl HasWindowHandle, attrs: WebViewAttributes) -> Result<Self> {
|
||||
WebViewBuilder::with_attributes(attrs).build(window)
|
||||
WebViewBuilder::new_with_attributes(attrs).build(window)
|
||||
}
|
||||
|
||||
/// Create [`WebViewBuilder`] as a child window inside the provided [`HasWindowHandle`].
|
||||
@@ -1782,7 +1782,7 @@ impl WebView {
|
||||
/// - Panics if the provided handle was not support or invalid.
|
||||
/// - Panics on Linux, if [`gtk::init`] was not called in this thread.
|
||||
pub fn new_as_child(parent: &impl HasWindowHandle, attrs: WebViewAttributes) -> Result<Self> {
|
||||
WebViewBuilder::with_attributes(attrs).build_as_child(parent)
|
||||
WebViewBuilder::new_with_attributes(attrs).build_as_child(parent)
|
||||
}
|
||||
|
||||
/// Returns the id of this webview.
|
||||
|
||||
Reference in New Issue
Block a user