Skip to content

Commit 9001f39

Browse files
committed
Improve the docstring of EntityPath
1 parent e7cc3ba commit 9001f39

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

crates/re_log_types/src/path/entity_path.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,21 @@ impl std::fmt::Debug for EntityPathHash {
6767

6868
// ----------------------------------------------------------------------------
6969

70-
/// The unique identifier of an entity, e.g. `camera/"ACME Örnöga"/points`
70+
/// The unique identifier of an entity, e.g. `camera/3/points`
7171
///
7272
/// The entity path is a list of [parts][EntityPathPart] separated by slashes.
73+
/// Each part is a non-empty string, that can contain any character.
74+
/// When written as a string, some characters in the parts need to be escaped with a `\`
75+
/// (only character, numbers, `.`, `-`, `_` does not need escaping).
7376
///
74-
/// Each part is either a [_name_][EntityPathPart::Name] of a limited set of characters,
75-
/// or an [`Index`][crate::Index].
76-
/// Names are like idenitifers in code, and must match the regex: `[a-zA-z0-9_-]+`
77-
/// Indices are like array indices or keys in a map or table, and can be any string,
78-
/// uuid, or number.
77+
/// See <https://www.rerun.io/docs/concepts/entity-path> for more on entity paths.
7978
///
80-
/// Reference-counted internally, so this is cheap to clone.
81-
///
82-
/// Implements [`nohash_hasher::IsEnabled`].
79+
/// `EntityPath` is reference-counted internally, so it is cheap to clone.
80+
/// It also has a precomputed hash and implemented [`nohash_hasher::IsEnabled`],
81+
/// so it is very cheap to use in a [`nohash_hasher::IntMap`] and [`nohash_hasher::IntSet`].
8382
///
8483
/// ```
85-
/// # use re_log_types::{EntityPath, EntityPathPart};
84+
/// # use re_log_types::EntityPath;
8685
/// assert_eq!(
8786
/// EntityPath::parse_strict(r#"camera/ACME\ Örnöga/points/42"#).unwrap(),
8887
/// EntityPath::new(vec![

crates/re_log_types/src/path/entity_path_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::path::EntityPathPart;
22

3-
/// `camera / "left" / points / #42`
3+
/// `camera/left/points/42`
44
///
55
/// Wrapped by [`crate::EntityPath`] together with a hash.
66
#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]

crates/re_log_types/src/path/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ pub use parse_path::PathParseError;
2525

2626
/// The different parts that make up an [`EntityPath`].
2727
///
28+
/// A non-empty string.
29+
///
2830
/// In the file system analogy, this is the name of a folder.
2931
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
3032
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]

0 commit comments

Comments
 (0)