Struct re_entity_db::EntityPath

source ·
pub struct EntityPath { /* private fields */ }
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(),
    ])
);

Implementations§

source§

impl EntityPath

source

pub fn root() -> EntityPath

source

pub fn new(parts: Vec<EntityPathPart>) -> EntityPath

source

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.

source

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.

source

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.

source

pub fn iter(&self) -> impl DoubleEndedIterator + ExactSizeIterator

source

pub fn last(&self) -> Option<&EntityPathPart>

source

pub fn as_slice(&self) -> &[EntityPathPart]

source

pub fn to_vec(&self) -> Vec<EntityPathPart>

source

pub fn is_root(&self) -> bool

source

pub fn starts_with(&self, prefix: &EntityPath) -> bool

Is this equals to, or a descendant of, the given path.

source

pub fn is_descendant_of(&self, other: &EntityPath) -> bool

Is this a strict descendant of the given path.

source

pub fn is_child_of(&self, other: &EntityPath) -> bool

Is this a direct child of the other path.

source

pub fn len(&self) -> usize

Number of parts

source

pub fn hash(&self) -> EntityPathHash

source

pub fn hash64(&self) -> u64

Precomputed 64-bit hash.

source

pub fn parent(&self) -> Option<EntityPath>

Return None if root.

source

pub fn join(&self, other: &EntityPath) -> EntityPath

source

pub fn incremental_walk<'a>( start: Option<&EntityPath>, end: &'a EntityPath, ) -> impl Iterator<Item = EntityPath> + 'a

Helper function to iterate over all incremental EntityPaths from start to end, NOT including start itself.

For example incremental_walk("foo", "foo/bar/baz") returns: ["foo/bar", "foo/bar/baz"]

source

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.

source

pub fn common_ancestor_of<'a>( entities: impl Iterator<Item = &'a EntityPath>, ) -> EntityPath

Returns the first common ancestor of a list of entity paths.

source

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

§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 DataPaths we are quite strict with what we allow. But when parsing EntityPaths 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.

source

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.

source

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

source§

fn clone(&self) -> EntityPath

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for EntityPath

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for EntityPath

source§

fn deserialize<D>( deserializer: D, ) -> Result<EntityPath, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for EntityPath

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl From<&[EntityPathPart]> for EntityPath

source§

fn from(path: &[EntityPathPart]) -> EntityPath

Converts to this type from the input type.
source§

impl From<&str> for EntityPath

source§

fn from(path: &str) -> EntityPath

Converts to this type from the input type.
source§

impl From<EntityPath> for EntityPath

source§

fn from(value: EntityPath) -> EntityPath

Converts to this type from the input type.
source§

impl From<EntityPath> for InstancePath

source§

fn from(entity_path: EntityPath) -> Self

Converts to this type from the input type.
source§

impl From<String> for EntityPath

source§

fn from(path: String) -> EntityPath

Converts to this type from the input type.
source§

impl From<Vec<EntityPathPart>> for EntityPath

source§

fn from(path: Vec<EntityPathPart>) -> EntityPath

Converts to this type from the input type.
source§

impl FromIterator<EntityPathPart> for EntityPath

source§

fn from_iter<T>(parts: T) -> EntityPath
where T: IntoIterator<Item = EntityPathPart>,

Creates a value from an iterator. Read more
source§

impl Hash for EntityPath

source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<Idx> Index<Idx> for EntityPath
where Idx: SliceIndex<[EntityPathPart]>,

source§

type Output = <Idx as SliceIndex<[EntityPathPart]>>::Output

The returned type after indexing.
source§

fn index(&self, index: Idx) -> &<EntityPath as Index<Idx>>::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Loggable for EntityPath

source§

type Name = ComponentName

source§

fn name() -> <EntityPath as Loggable>::Name

The fully-qualified name of this loggable, e.g. rerun.datatypes.Vec2D.
source§

fn arrow_datatype() -> DataType

The underlying 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,

Given an iterator of options of owned or reference values to the current Loggable, serializes them into an Arrow array. The Arrow array’s datatype will match Loggable::arrow_field. Read more
source§

fn to_arrow<'a>( data: impl IntoIterator<Item = impl Into<Cow<'a, EntityPath>>>, ) -> Result<Box<dyn Array>, SerializationError>
where EntityPath: 'a,

Given an iterator of owned or reference values to the current Loggable, serializes them into an Arrow array. The Arrow array’s datatype will match Loggable::arrow_field. Read more
source§

fn from_arrow( array: &(dyn Array + 'static), ) -> Result<Vec<EntityPath>, DeserializationError>

Given an Arrow array, deserializes it into a collection of Loggables. Read more
source§

fn extended_arrow_datatype() -> DataType

The underlying arrow2::datatypes::DataType, including datatype extensions. Read more
source§

fn arrow_field() -> Field

The underlying arrow2::datatypes::Field, including datatype extensions. Read more
source§

fn from_arrow_opt( data: &(dyn Array + 'static), ) -> Result<Vec<Option<Self>>, DeserializationError>

Given an Arrow array, deserializes it into a collection of optional Loggables. Read more
source§

impl Ord for EntityPath

source§

fn cmp(&self, other: &EntityPath) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for EntityPath

source§

fn eq(&self, other: &EntityPath) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for EntityPath

source§

fn partial_cmp(&self, other: &EntityPath) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for EntityPath

source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl SizeBytes for EntityPath

source§

fn heap_size_bytes(&self) -> u64

Returns the total size of self on the heap, in bytes.
source§

fn total_size_bytes(&self) -> u64

Returns the total size of self in bytes, accounting for both stack and heap space.
source§

fn stack_size_bytes(&self) -> u64

Returns the total size of self on the stack, in bytes. Read more
source§

fn is_pod() -> bool

Is Self just plain old data? Read more
source§

impl Eq for EntityPath

source§

impl IsEnabled for EntityPath

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<L> LoggableBatch for L
where L: Clone + Loggable,

source§

type Name = <L as Loggable>::Name

source§

fn name(&self) -> <L as LoggableBatch>::Name

The fully-qualified name of this batch, e.g. rerun.datatypes.Vec2D.
source§

fn num_instances(&self) -> usize

The number of component instances stored into this batch.
source§

fn arrow_field(&self) -> Field

The underlying arrow2::datatypes::Field, including datatype extensions.
source§

fn to_arrow(&self) -> Result<Box<dyn Array>, SerializationError>

Serializes the batch into an Arrow array.
source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<L> Component for L
where L: Loggable<Name = ComponentName>,

source§

impl<C> ComponentBatch for C
where C: Component,

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,