Add documentation to many core editor types (#7919)

Hopefully this makes it a bit easier for new contributors to dive into
the codebase :)

Release Notes:

- Improved documentation for many core editor types

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
vultix
2024-02-17 09:03:05 -07:00
committed by GitHub
co-authored by Nathan Sobo
parent f19378135a
commit 8aa5319210
15 changed files with 138 additions and 5 deletions
+3
View File
@@ -6,10 +6,13 @@ use anyhow::Result;
use std::{cmp::Ordering, fmt::Debug, ops::Range};
use sum_tree::Bias;
/// A timestamped position in a buffer
#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash, Default)]
pub struct Anchor {
pub timestamp: clock::Lamport,
/// The byte offset in the buffer
pub offset: usize,
/// Describes which character the anchor is biased towards
pub bias: Bias,
pub buffer_id: Option<BufferId>,
}
+7
View File
@@ -7,6 +7,13 @@ lazy_static! {
static ref MAX: Locator = Locator::max();
}
/// An identifier for a position in a ordered collection.
///
/// Allows prepending and appending without needing to renumber existing locators
/// using `Locator::between(lhs, rhs)`.
///
/// The initial location for a collection should be `Locator::between(Locator::min(), Locator::max())`,
/// leaving room for items to be inserted before and after it.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Locator(SmallVec<[u64; 4]>);