You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exposing Automerge::get_marks through to Swift (#186)
* rust: implement get_marks at given position/cursor
* swift: implement get_marks at given position/cursor
* unit test: get_marks at given position/cursor
* doc: curation::marksAt given position/cursor
* Update Sources/Automerge/Document.swift
Co-authored-by: Joseph Heck <[email protected]>
* comments: unified implementation of marks at position
* add missing links into documentation
* minor adjustments for binding `marksAt` from swift to rust
* comments: add detailed information of use for `marksAt`
* minor: reduce verbosity of the api doc for marksAt
* removing unnecessary public accessibility to the cursor
---------
Co-authored-by: Joseph Heck <[email protected]>
/// let cursor = try doc.cursor(obj: textId, position: 0)
788
+
/// let marks = try doc.marksAt(obj: textId, position: .cursor(cursor), heads: doc.heads())
789
+
/// ```
790
+
///
791
+
/// ## Recommendation
792
+
/// Use this method to query the marks applied to a text object at a specific position.
793
+
/// This can be useful for retrieving ``Marks`` related to a character without traversing the full document.
794
+
///
795
+
/// ## When to Use Cursor vs. Index
796
+
///
797
+
/// While you can specify the position either with a `Cursor` or an `Index`, there are important distinctions:
798
+
///
799
+
/// - **Cursor**: Use a `Cursor` when you need to track a position that might change over time due to edits in the text object. A `Cursor` provides a way to maintain a reference to a logical position within the text even if the text content changes, making it more robust in collaborative or frequently edited documents.
800
+
///
801
+
/// - **Index**: Use an `Index` when you have a fixed position and you are sure that the text content will not change, or changes are irrelevant to your current operation. An index is a straightforward approach for static text content.
/// let cursor = try doc.cursor(obj: textId, position: 0)
837
+
/// let marks = try doc.marksAt(obj: textId, position: .cursor(cursor), heads: doc.heads())
838
+
/// ```
839
+
///
840
+
/// ## Recommendation
841
+
/// Use this method to query the marks applied to a text object at a specific position.
842
+
/// This can be useful for retrieving ``Marks`` related to a character without traversing the full document.
843
+
///
844
+
/// ## When to Use Cursor vs. Index
845
+
///
846
+
/// While you can specify the position either with a `Cursor` or an `Index`, there are important distinctions:
847
+
///
848
+
/// - **Cursor**: Use a `Cursor` when you need to track a position that might change over time due to edits in the text object. A `Cursor` provides a way to maintain a reference to a logical position within the text even if the text content changes, making it more robust in collaborative or frequently edited documents.
849
+
///
850
+
/// - **Index**: Use an `Index` when you have a fixed position and you are sure that the text content will not change, or changes are irrelevant to your current operation. An index is a straightforward approach for static text content.
0 commit comments