Struct re_log_types::path::EntityPath
source · pub struct EntityPath {
hash: EntityPathHash,
parts: Arc<Vec<EntityPathPart>>,
}
Expand description
The unique identifier of an entity, e.g. camera/3/points
The entity path is a list of parts separated by slashes.
Each part is a non-empty string, that can contain any character.
When written as a string, some characters in the parts need to be escaped with a \
(only character, numbers, .
, -
, _
does not need escaping).
See https://www.rerun.io/docs/concepts/entity-path for more on entity paths.
This is basically implemented as a list of strings, but is reference-counted internally, so it is cheap to clone.
It also has a precomputed hash and implemented [nohash_hasher::IsEnabled
],
so it is very cheap to use in a [nohash_hasher::IntMap
] and [nohash_hasher::IntSet
].
assert_eq!(
EntityPath::parse_strict(r#"camera/ACME\ Örnöga/points/42"#).unwrap(),
EntityPath::new(vec![
"camera".into(),
"ACME Örnöga".into(),
"points".into(),
"42".into(),
])
);
Fields§
§hash: EntityPathHash
precomputed hash
parts: Arc<Vec<EntityPathPart>>
Implementations§
source§impl EntityPath
impl EntityPath
pub fn root() -> Self
pub fn new(parts: Vec<EntityPathPart>) -> Self
sourcepub fn from_file_path_as_single_string(file_path: &Path) -> Self
pub fn from_file_path_as_single_string(file_path: &Path) -> Self
Treat the file path as one opaque string.
The file path separators will NOT become splits in the new path. The returned path will only have one part.
sourcepub fn from_file_path(file_path: &Path) -> Self
pub fn from_file_path(file_path: &Path) -> Self
Treat the file path as an entity path hierarchy.
The file path separators will become splits in the new path.
sourcepub fn from_single_string(string: impl Into<InternedString>) -> Self
pub fn from_single_string(string: impl Into<InternedString>) -> Self
Treat the string as one opaque string, NOT splitting on any slashes.
The given string is expected to be unescaped, i.e. any \
is treated as a normal character.
pub fn iter( &self ) -> impl DoubleEndedIterator<Item = &EntityPathPart> + ExactSizeIterator
pub fn last(&self) -> Option<&EntityPathPart>
pub fn as_slice(&self) -> &[EntityPathPart]
pub fn to_vec(&self) -> Vec<EntityPathPart>
pub fn is_root(&self) -> bool
sourcepub fn starts_with(&self, prefix: &Self) -> bool
pub fn starts_with(&self, prefix: &Self) -> bool
Is this equals to, or a descendant of, the given path.
sourcepub fn is_descendant_of(&self, other: &Self) -> bool
pub fn is_descendant_of(&self, other: &Self) -> bool
Is this a strict descendant of the given path.
sourcepub fn is_child_of(&self, other: &Self) -> bool
pub fn is_child_of(&self, other: &Self) -> bool
Is this a direct child of the other path.
pub fn hash(&self) -> EntityPathHash
pub fn join(&self, other: &Self) -> Self
sourcepub fn incremental_walk<'a>(
start: Option<&Self>,
end: &'a Self
) -> impl Iterator<Item = Self> + 'a
pub fn incremental_walk<'a>( start: Option<&Self>, end: &'a Self ) -> impl Iterator<Item = Self> + 'a
Helper function to iterate over all incremental EntityPath
s from start to end, NOT including start itself.
For example incremental_walk("foo", "foo/bar/baz")
returns: ["foo/bar", "foo/bar/baz"]
sourcepub fn common_ancestor(&self, other: &Self) -> Self
pub fn common_ancestor(&self, other: &Self) -> Self
Returns the first common ancestor of two paths.
If both paths are the same, the common ancestor is the path itself.
sourcepub fn common_ancestor_of<'a>(entities: impl Iterator<Item = &'a Self>) -> Self
pub fn common_ancestor_of<'a>(entities: impl Iterator<Item = &'a Self>) -> Self
Returns the first common ancestor of a list of entity paths.
sourcepub fn short_names_with_disambiguation(
entities: impl IntoIterator<Item = Self>
) -> HashMap<Self, String>
pub fn short_names_with_disambiguation( entities: impl IntoIterator<Item = Self> ) -> HashMap<Self, String>
Returns short names for a collection of entities based on the last part(s), ensuring uniqueness. Disambiguation is achieved by increasing the number of entity parts used.
Note: the result is undefined when the input contains duplicates.
source§impl EntityPath
impl EntityPath
§Entity path parsing
When parsing a DataPath
, it is important that we can distinguish the
component and index from the actual entity path. This requires
us to forbid certain characters in an entity part name.
For instance, in foo/bar.baz
, is baz
a component name, or part of the entity path?
So, when parsing a full DataPath
s we are quite strict with what we allow.
But when parsing EntityPath
s we want to be a bit more forgiving, so we
can accept things like foo/bar.baz
and transform it into foo/"bar.baz"
.
This allows user to do things like log(f"foo/{filename}", my_mesh)
without
Rerun throwing a fit.
sourcepub fn parse_strict(input: &str) -> Result<Self, PathParseError>
pub fn parse_strict(input: &str) -> Result<Self, PathParseError>
Parse an entity path from a string, with strict checks for correctness.
Parses anything that ent_path.to_string()
outputs.
For a forgiving parse that accepts anything, use Self::parse_forgiving
.
sourcepub fn parse_forgiving(input: &str) -> Self
pub fn parse_forgiving(input: &str) -> Self
Parses an entity path, handling any malformed input with a logged warning.
Things like foo/Hallå Där!
will be accepted, and transformed into
the path foo/Hallå\ Där\!
.
For a strict parses, use Self::parse_strict
instead.
Trait Implementations§
source§impl Clone for EntityPath
impl Clone for EntityPath
source§fn clone(&self) -> EntityPath
fn clone(&self) -> EntityPath
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for EntityPath
impl Debug for EntityPath
source§impl<'de> Deserialize<'de> for EntityPath
impl<'de> Deserialize<'de> for EntityPath
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
source§impl Display for EntityPath
impl Display for EntityPath
source§impl From<&[EntityPathPart]> for EntityPath
impl From<&[EntityPathPart]> for EntityPath
source§fn from(path: &[EntityPathPart]) -> Self
fn from(path: &[EntityPathPart]) -> Self
source§impl<'a> From<&'a EntityPath> for Cow<'a, EntityPath>
impl<'a> From<&'a EntityPath> for Cow<'a, EntityPath>
source§fn from(value: &'a EntityPath) -> Self
fn from(value: &'a EntityPath) -> Self
source§impl From<&EntityPath> for EntityPath
impl From<&EntityPath> for EntityPath
source§fn from(value: &EntityPath) -> Self
fn from(value: &EntityPath) -> Self
source§impl From<&str> for EntityPath
impl From<&str> for EntityPath
source§impl<'a> From<EntityPath> for Cow<'a, EntityPath>
impl<'a> From<EntityPath> for Cow<'a, EntityPath>
source§fn from(value: EntityPath) -> Self
fn from(value: EntityPath) -> Self
source§impl From<EntityPath> for EntityPath
impl From<EntityPath> for EntityPath
source§fn from(value: EntityPath) -> Self
fn from(value: EntityPath) -> Self
source§impl From<EntityPath> for EntityPathRule
impl From<EntityPath> for EntityPathRule
source§fn from(entity_path: EntityPath) -> Self
fn from(entity_path: EntityPath) -> Self
source§impl From<EntityPath> for String
impl From<EntityPath> for String
source§fn from(path: EntityPath) -> Self
fn from(path: EntityPath) -> Self
source§impl From<String> for EntityPath
impl From<String> for EntityPath
source§impl From<Vec<EntityPathPart>> for EntityPath
impl From<Vec<EntityPathPart>> for EntityPath
source§fn from(path: Vec<EntityPathPart>) -> Self
fn from(path: Vec<EntityPathPart>) -> Self
source§impl FromIterator<EntityPathPart> for EntityPath
impl FromIterator<EntityPathPart> for EntityPath
source§fn from_iter<T: IntoIterator<Item = EntityPathPart>>(parts: T) -> Self
fn from_iter<T: IntoIterator<Item = EntityPathPart>>(parts: T) -> Self
source§impl Hash for EntityPath
impl Hash for EntityPath
source§impl<Idx> Index<Idx> for EntityPathwhere
Idx: SliceIndex<[EntityPathPart]>,
impl<Idx> Index<Idx> for EntityPathwhere
Idx: SliceIndex<[EntityPathPart]>,
§type Output = <Idx as SliceIndex<[EntityPathPart]>>::Output
type Output = <Idx as SliceIndex<[EntityPathPart]>>::Output
source§impl Loggable for EntityPath
impl Loggable for EntityPath
type Name = ComponentName
source§fn name() -> Self::Name
fn name() -> Self::Name
rerun.datatypes.Vec2D
.source§fn arrow_datatype() -> DataType
fn arrow_datatype() -> DataType
arrow2::datatypes::DataType
], excluding datatype extensions.source§fn to_arrow_opt<'a>(
_data: impl IntoIterator<Item = Option<impl Into<Cow<'a, Self>>>>
) -> SerializationResult<Box<dyn Array>>where
Self: 'a,
fn to_arrow_opt<'a>(
_data: impl IntoIterator<Item = Option<impl Into<Cow<'a, Self>>>>
) -> SerializationResult<Box<dyn Array>>where
Self: 'a,
source§fn to_arrow<'a>(
data: impl IntoIterator<Item = impl Into<Cow<'a, Self>>>
) -> SerializationResult<Box<dyn Array>>where
Self: 'a,
fn to_arrow<'a>(
data: impl IntoIterator<Item = impl Into<Cow<'a, Self>>>
) -> SerializationResult<Box<dyn Array>>where
Self: 'a,
source§fn from_arrow(array: &dyn Array) -> DeserializationResult<Vec<Self>>
fn from_arrow(array: &dyn Array) -> DeserializationResult<Vec<Self>>
Loggable
s.source§fn from_arrow_opt(
data: &(dyn Array + 'static)
) -> Result<Vec<Option<Self>>, DeserializationError>
fn from_arrow_opt( data: &(dyn Array + 'static) ) -> Result<Vec<Option<Self>>, DeserializationError>
Loggable
s.source§impl Ord for EntityPath
impl Ord for EntityPath
source§impl PartialEq for EntityPath
impl PartialEq for EntityPath
source§impl PartialOrd for EntityPath
impl PartialOrd for EntityPath
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for EntityPath
impl Serialize for EntityPath
source§impl SizeBytes for EntityPath
impl SizeBytes for EntityPath
source§fn heap_size_bytes(&self) -> u64
fn heap_size_bytes(&self) -> u64
self
on the heap, in bytes.source§fn total_size_bytes(&self) -> u64
fn total_size_bytes(&self) -> u64
self
in bytes, accounting for both stack and heap space.source§fn stack_size_bytes(&self) -> u64
fn stack_size_bytes(&self) -> u64
self
on the stack, in bytes. Read moreimpl Eq for EntityPath
impl IsEnabled for EntityPath
Auto Trait Implementations§
impl Freeze for EntityPath
impl RefUnwindSafe for EntityPath
impl Send for EntityPath
impl Sync for EntityPath
impl Unpin for EntityPath
impl UnwindSafe for EntityPath
Blanket Implementations§
source§impl<C> AsComponents for Cwhere
C: Component,
impl<C> AsComponents for Cwhere
C: Component,
source§fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
ComponentBatch
s. Read moresource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<C> ComponentBatch for Cwhere
C: Component,
impl<C> ComponentBatch for Cwhere
C: Component,
source§fn to_arrow_list_array(&self) -> Result<ListArray<i32>, SerializationError>
fn to_arrow_list_array(&self) -> Result<ListArray<i32>, SerializationError>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more