Struct rerun::sdk::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
§parts: Arc<Vec<EntityPathPart>>
Implementations§
source§impl EntityPath
impl EntityPath
pub fn root() -> EntityPath
pub fn new(parts: Vec<EntityPathPart>) -> EntityPath
sourcepub fn from_file_path_as_single_string(file_path: &Path) -> EntityPath
pub fn from_file_path_as_single_string(file_path: &Path) -> EntityPath
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) -> EntityPath
pub fn from_file_path(file_path: &Path) -> EntityPath
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>) -> EntityPath
pub fn from_single_string(string: impl Into<InternedString>) -> EntityPath
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 + 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: &EntityPath) -> bool
pub fn starts_with(&self, prefix: &EntityPath) -> bool
Is this equals to, or a descendant of, the given path.
sourcepub fn is_descendant_of(&self, other: &EntityPath) -> bool
pub fn is_descendant_of(&self, other: &EntityPath) -> bool
Is this a strict descendant of the given path.
sourcepub fn is_child_of(&self, other: &EntityPath) -> bool
pub fn is_child_of(&self, other: &EntityPath) -> bool
Is this a direct child of the other path.
pub fn hash(&self) -> EntityPathHash
sourcepub fn parent(&self) -> Option<EntityPath>
pub fn parent(&self) -> Option<EntityPath>
Return None
if root.
pub fn join(&self, other: &EntityPath) -> EntityPath
sourcepub fn incremental_walk<'a>(
start: Option<&EntityPath>,
end: &'a EntityPath
) -> impl Iterator<Item = EntityPath> + 'a
pub fn incremental_walk<'a>( start: Option<&EntityPath>, end: &'a EntityPath ) -> impl Iterator<Item = EntityPath> + '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: &EntityPath) -> EntityPath
pub fn common_ancestor(&self, other: &EntityPath) -> EntityPath
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 EntityPath>
) -> EntityPath
pub fn common_ancestor_of<'a>( entities: impl Iterator<Item = &'a EntityPath> ) -> EntityPath
Returns the first common ancestor of a list of entity paths.
sourcepub fn short_names_with_disambiguation(
entities: impl IntoIterator<Item = EntityPath>
) -> HashMap<EntityPath, String, RandomState>
pub fn short_names_with_disambiguation( entities: impl IntoIterator<Item = EntityPath> ) -> HashMap<EntityPath, String, RandomState>
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<EntityPath, PathParseError>
pub fn parse_strict(input: &str) -> Result<EntityPath, 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) -> EntityPath
pub fn parse_forgiving(input: &str) -> EntityPath
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 DataUi for EntityPath
impl DataUi for EntityPath
source§fn data_ui(
&self,
ctx: &ViewerContext<'_>,
ui: &mut Ui,
ui_layout: UiLayout,
query: &LatestAtQuery,
db: &EntityDb
)
fn data_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, ui_layout: UiLayout, query: &LatestAtQuery, db: &EntityDb )
source§fn data_ui_recording(
&self,
ctx: &ViewerContext<'_>,
ui: &mut Ui,
ui_layout: UiLayout
)
fn data_ui_recording( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, ui_layout: UiLayout )
Self::data_ui
using the default query and recording.source§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: D
) -> Result<EntityPath, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<EntityPath, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
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]) -> EntityPath
fn from(path: &[EntityPathPart]) -> EntityPath
source§impl From<&EntityPath> for EntityPath
impl From<&EntityPath> for EntityPath
source§fn from(value: &EntityPath) -> EntityPath
fn from(value: &EntityPath) -> EntityPath
source§impl From<&str> for EntityPath
impl From<&str> for EntityPath
source§fn from(path: &str) -> EntityPath
fn from(path: &str) -> EntityPath
source§impl From<EntityPath> for EntityPath
impl From<EntityPath> for EntityPath
source§fn from(value: EntityPath) -> EntityPath
fn from(value: EntityPath) -> EntityPath
source§impl From<EntityPath> for EntityPath
impl From<EntityPath> for EntityPath
source§fn from(value: EntityPath) -> EntityPath
fn from(value: EntityPath) -> EntityPath
source§impl From<EntityPath> for EntityPathRule
impl From<EntityPath> for EntityPathRule
source§fn from(entity_path: EntityPath) -> EntityPathRule
fn from(entity_path: EntityPath) -> EntityPathRule
source§impl From<EntityPath> for InstancePath
impl From<EntityPath> for InstancePath
source§fn from(entity_path: EntityPath) -> InstancePath
fn from(entity_path: EntityPath) -> InstancePath
source§impl From<EntityPath> for Item
impl From<EntityPath> for Item
source§fn from(entity_path: EntityPath) -> Item
fn from(entity_path: EntityPath) -> Item
source§impl From<EntityPath> for String
impl From<EntityPath> for String
source§fn from(path: EntityPath) -> String
fn from(path: EntityPath) -> String
source§impl From<String> for EntityPath
impl From<String> for EntityPath
source§fn from(path: String) -> EntityPath
fn from(path: String) -> EntityPath
source§impl From<Vec<EntityPathPart>> for EntityPath
impl From<Vec<EntityPathPart>> for EntityPath
source§fn from(path: Vec<EntityPathPart>) -> EntityPath
fn from(path: Vec<EntityPathPart>) -> EntityPath
source§impl FromIterator<EntityPathPart> for EntityPath
impl FromIterator<EntityPathPart> for EntityPath
source§fn from_iter<T>(parts: T) -> EntityPathwhere
T: IntoIterator<Item = EntityPathPart>,
fn from_iter<T>(parts: T) -> EntityPathwhere
T: IntoIterator<Item = EntityPathPart>,
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() -> <EntityPath as Loggable>::Name
fn name() -> <EntityPath as Loggable>::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, EntityPath>>>>
) -> Result<Box<dyn Array>, SerializationError>where
EntityPath: 'a,
fn to_arrow_opt<'a>(
_data: impl IntoIterator<Item = Option<impl Into<Cow<'a, EntityPath>>>>
) -> Result<Box<dyn Array>, SerializationError>where
EntityPath: 'a,
source§fn to_arrow<'a>(
data: impl IntoIterator<Item = impl Into<Cow<'a, EntityPath>>>
) -> Result<Box<dyn Array>, SerializationError>where
EntityPath: 'a,
fn to_arrow<'a>(
data: impl IntoIterator<Item = impl Into<Cow<'a, EntityPath>>>
) -> Result<Box<dyn Array>, SerializationError>where
EntityPath: 'a,
source§fn from_arrow(
array: &(dyn Array + 'static)
) -> Result<Vec<EntityPath>, DeserializationError>
fn from_arrow( array: &(dyn Array + 'static) ) -> Result<Vec<EntityPath>, DeserializationError>
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§fn cmp(&self, other: &EntityPath) -> Ordering
fn cmp(&self, other: &EntityPath) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for EntityPath
impl PartialEq for EntityPath
source§fn eq(&self, other: &EntityPath) -> bool
fn eq(&self, other: &EntityPath) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for EntityPath
impl PartialOrd for EntityPath
source§fn partial_cmp(&self, other: &EntityPath) -> Option<Ordering>
fn partial_cmp(&self, other: &EntityPath) -> Option<Ordering>
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§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
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 moresource§impl SyntaxHighlighting for EntityPath
impl SyntaxHighlighting for EntityPath
fn syntax_highlight_into(&self, style: &Style, job: &mut LayoutJob)
fn syntax_highlighted(&self, style: &Style) -> LayoutJob
impl 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
source§impl<T> EntityDataUi for Twhere
T: DataUi,
impl<T> EntityDataUi for Twhere
T: DataUi,
source§fn entity_data_ui(
&self,
ctx: &ViewerContext<'_>,
ui: &mut Ui,
ui_layout: UiLayout,
entity_path: &EntityPath,
_row_id: Option<RowId>,
query: &LatestAtQuery,
db: &EntityDb
)
fn entity_data_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, ui_layout: UiLayout, entity_path: &EntityPath, _row_id: Option<RowId>, query: &LatestAtQuery, db: &EntityDb )
§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.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request