Skip to content

Commit c9b2fa9

Browse files
Add .equal(:)
1 parent 9aa8a11 commit c9b2fa9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/LightTableDelta/Delta.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ public enum Delta<Element> {
3737
/// The source and target elements can be different or equal.
3838
case modified(source: Element, target: Element)
3939

40+
/// Returns a modified delta where both the source and target share the same element.
41+
@inlinable @inline(__always)
42+
public static func equal(_ element: Element) -> Self {
43+
.modified(source: element, target: element)
44+
}
45+
4046
/// Creates a modified delta from a source and a target element.
4147
@inlinable @inline(__always)
4248
public init(source: Element, target: Element) {

0 commit comments

Comments
 (0)