Skip to content

Commit bf08e30

Browse files
committed
change(faup-rs): move into_owned to bottom to change order in doc
1 parent d9c855d commit bf08e30

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

faup/src/lib.rs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -643,39 +643,6 @@ impl<'url> Url<'url> {
643643
})
644644
}
645645

646-
/// Converts this borrowed `Url` into an owned `Url`.
647-
///
648-
/// This is useful when you need to store the `Url` for longer than the lifetime of the input string.
649-
///
650-
/// # Performance
651-
///
652-
/// When using this method strings will be cloned.
653-
///
654-
/// # Returns
655-
///
656-
/// * `Url<'owned>` - An owned version of the URL.
657-
///
658-
/// # Examples
659-
///
660-
/// ```
661-
/// use faup_rs::Url;
662-
///
663-
/// let url = Url::parse("https://example.com").unwrap();
664-
/// let owned_url = url.into_owned();
665-
/// ```
666-
pub fn into_owned<'owned>(self) -> Url<'owned> {
667-
Url {
668-
orig: Cow::Owned(self.orig.into_owned()),
669-
scheme: Cow::Owned(self.scheme.into_owned()),
670-
userinfo: self.userinfo.map(|u| u.into_owned()),
671-
host: self.host.into_owned(),
672-
port: self.port,
673-
path: self.path.map(|p| Cow::Owned(p.into_owned())),
674-
query: self.query.map(|q| Cow::Owned(q.into_owned())),
675-
fragment: self.fragment.map(|f| Cow::Owned(f.into_owned())),
676-
}
677-
}
678-
679646
/// Creates a new `Url` by parsing a string slice.
680647
///
681648
/// # Arguments
@@ -952,6 +919,39 @@ impl<'url> Url<'url> {
952919
pub fn fragment(&self) -> Option<&str> {
953920
self.fragment.as_ref().map(|p| p.as_ref())
954921
}
922+
923+
/// Converts this borrowed `Url` into an owned `Url`.
924+
///
925+
/// This is useful when you need to store the `Url` for longer than the lifetime of the input string.
926+
///
927+
/// # Performance
928+
///
929+
/// When using this method strings will be cloned.
930+
///
931+
/// # Returns
932+
///
933+
/// * `Url<'owned>` - An owned version of the URL.
934+
///
935+
/// # Examples
936+
///
937+
/// ```
938+
/// use faup_rs::Url;
939+
///
940+
/// let url = Url::parse("https://example.com").unwrap();
941+
/// let owned_url = url.into_owned();
942+
/// ```
943+
pub fn into_owned<'owned>(self) -> Url<'owned> {
944+
Url {
945+
orig: Cow::Owned(self.orig.into_owned()),
946+
scheme: Cow::Owned(self.scheme.into_owned()),
947+
userinfo: self.userinfo.map(|u| u.into_owned()),
948+
host: self.host.into_owned(),
949+
port: self.port,
950+
path: self.path.map(|p| Cow::Owned(p.into_owned())),
951+
query: self.query.map(|q| Cow::Owned(q.into_owned())),
952+
fragment: self.fragment.map(|f| Cow::Owned(f.into_owned())),
953+
}
954+
}
955955
}
956956

957957
#[cfg(test)]

0 commit comments

Comments
 (0)