11#![ allow( non_snake_case) ]
22
3+ use std:: borrow:: Cow ;
34use std:: collections:: HashMap ;
45
56use pyo3:: {
@@ -201,13 +202,13 @@ pub enum UrlPatternInput<'py> {
201202 Init ( Bound < ' py , PyDict > ) ,
202203}
203204
204- impl < ' py > TryFrom < UrlPatternInput < ' py > > for deno_urlpattern:: quirks:: StringOrInit {
205+ impl < ' py > TryFrom < UrlPatternInput < ' py > > for deno_urlpattern:: quirks:: StringOrInit < ' static > {
205206 type Error = pyo3:: PyErr ;
206207
207208 fn try_from ( input : UrlPatternInput < ' py > ) -> Result < Self , Self :: Error > {
208209 Ok ( match input {
209210 UrlPatternInput :: String ( pattern) => {
210- deno_urlpattern:: quirks:: StringOrInit :: String ( pattern)
211+ deno_urlpattern:: quirks:: StringOrInit :: String ( Cow :: Owned ( pattern) )
211212 }
212213 UrlPatternInput :: Init ( init) => deno_urlpattern:: quirks:: StringOrInit :: Init (
213214 deno_urlpattern:: quirks:: UrlPatternInit {
@@ -254,7 +255,10 @@ impl<'py> TryFrom<UrlPatternInput<'py>> for deno_urlpattern::quirks::StringOrIni
254255}
255256
256257pub struct UrlPatternResult {
257- pub inputs : ( deno_urlpattern:: quirks:: StringOrInit , Option < String > ) ,
258+ pub inputs : (
259+ deno_urlpattern:: quirks:: StringOrInit < ' static > ,
260+ Option < String > ,
261+ ) ,
258262 pub protocol : UrlPatternComponentResult ,
259263 pub username : UrlPatternComponentResult ,
260264 pub password : UrlPatternComponentResult ,
@@ -278,7 +282,7 @@ impl<'py> IntoPyObject<'py> for UrlPatternResult {
278282
279283 match string_or_init {
280284 deno_urlpattern:: quirks:: StringOrInit :: String ( string) => {
281- list. append ( string) . unwrap ( ) ;
285+ list. append ( string. into_owned ( ) ) . unwrap ( ) ;
282286 }
283287 deno_urlpattern:: quirks:: StringOrInit :: Init ( init) => {
284288 let init_dict = PyDict :: new ( py) ;
0 commit comments