diff --git a/.changes/builder-naming.md b/.changes/builder-naming.md new file mode 100644 index 0000000..f3af49c --- /dev/null +++ b/.changes/builder-naming.md @@ -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` diff --git a/src/lib.rs b/src/lib.rs index a8650a5..0ae9127 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 { - 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 { - WebViewBuilder::with_attributes(attrs).build_as_child(parent) + WebViewBuilder::new_with_attributes(attrs).build_as_child(parent) } /// Returns the id of this webview.