Skip to content

Commit 5c78d85

Browse files
committed
Add comment clarifying rationale behind ResolvedTopicReference's immutability
1 parent a158311 commit 5c78d85

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Sources/SwiftDocC/Model/Identifier.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,16 @@ public enum TopicReferenceResolutionResult: Hashable, CustomStringConvertible {
7474
/// (i.e. there is a file on disk or data in memory ready to be
7575
/// recalled at any time).
7676
///
77-
/// > Important: This type has copy-on-write semantics.
77+
/// ## Implementation Details
78+
///
79+
/// `ResolvedTopicReference` is effectively a wrapper around Foundation's `URL` and,
80+
/// because of this, it exposes an API very similar to `URL` and does not allow direct modification
81+
/// of its properties. This immutability brings performance benefits and communicates with
82+
/// user's of the API that doing something like adding a path component
83+
/// is a potentially expensive operation, just as it is on `URL`.
84+
///
85+
/// > Important: This type has copy-on-write semantics and wraps an underlying class to store
86+
/// > its data.
7887
public struct ResolvedTopicReference: Hashable, Codable, Equatable, CustomStringConvertible {
7988
typealias ReferenceBundleIdentifier = String
8089
typealias ReferenceKey = String

0 commit comments

Comments
 (0)