Struct re_viewer::external::re_entity_db::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

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 DataUi for EntityPath

source§

fn data_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, ui_layout: UiLayout, query: &LatestAtQuery, db: &EntityDb )

If you need to lookup something in the chunk store, use the given query to do so.
source§

fn data_ui_recording( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, ui_layout: UiLayout )

Called Self::data_ui using the default query and recording.
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<&EntityPath> for EntityPath

source§

fn from(value: &EntityPath) -> 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 EntityPath

source§

fn from(value: EntityPath) -> EntityPath

Converts to this type from the input type.
source§

impl From<EntityPath> for EntityPathRule

source§

fn from(entity_path: EntityPath) -> EntityPathRule

Converts to this type from the input type.
source§

impl From<EntityPath> for InstancePath

source§

fn from(entity_path: EntityPath) -> InstancePath

Converts to this type from the input type.
source§

impl From<EntityPath> for String

source§

fn from(path: EntityPath) -> String

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]>,

§

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

§

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. 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. 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.
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.
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

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

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

This method 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

This method 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

This method 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

This method 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

This method 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 SyntaxHighlighting for EntityPath

source§

fn syntax_highlight_into(&self, style: &Style, job: &mut LayoutJob)

source§

fn syntax_highlighted(&self, style: &Style) -> LayoutJob

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<C> AsComponents for C
where C: Component,

source§

fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>

Exposes the object’s contents as a set of ComponentBatchs. Read more
source§

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

Serializes all non-null Components of this bundle into Arrow arrays. 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.
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

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

source§

fn to_arrow_list_array(&self) -> Result<ListArray<i32>, SerializationError>

Serializes the batch into an Arrow list array with a single component per list.
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

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

source§

impl<T> EntityDataUi for T
where 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 )

If you need to lookup something in the chunk store, use the given query to do so.
§

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

§

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

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

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

§

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

Compare self to key and return true if they are equal.
source§

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

source§

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

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

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

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

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<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

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

§

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 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.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

§

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.
§

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

§

fn to<T>(self) -> T
where Self: Into<T>,

Converts to T by calling Into<T>::into.
§

fn try_to<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Tries to convert to T by calling TryInto<T>::try_into.
source§

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

§

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
§

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

§

fn to_smolstr(&self) -> SmolStr

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

§

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

§

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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

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.
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

source§

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

source§

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

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + Serialize + for<'a> Deserialize<'a> + Send + Sync,

§

impl<T> Ungil for T
where T: Send,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,