Skip to content

Commit c836c3d

Browse files
CopilotByron
andcommitted
doc: Add documentation explaining URL serialization and password handling
Co-authored-by: Byron <63622+Byron@users.noreply.github.com>
1 parent 8699d0f commit c836c3d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

gix-url/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ pub enum ArgumentSafety<'a> {
8585
/// parameters, but never be accepted as an instance of this type and then reconstructed, to maintain
8686
/// validity guarantees.
8787
///
88+
/// # Serialization
89+
///
90+
/// This type does not implement `Into<String>` or `From<Url> for String` because URLs can contain
91+
/// non-UTF-8 sequences in the path component. Use [to_bstring()](Url::to_bstring()) for lossless
92+
/// serialization, or use the [`Display`](std::fmt::Display) trait for a UTF-8 representation that
93+
/// redacts passwords for safe logging.
94+
///
95+
/// When the `serde` feature is enabled, this type implements `serde::Serialize` and `serde::Deserialize`,
96+
/// which will serialize *all* fields including passwords. The password is never serialized through the
97+
/// `Display` trait or in any other context unless the `serde` feature is enabled and serde serialization
98+
/// is explicitly used.
99+
///
88100
/// # Security Warning
89101
///
90102
/// URLs may contain passwords and using standard [formatting](std::fmt::Display) will redact

0 commit comments

Comments
 (0)