Struct usd::pxr::sdf::Path

source ·
#[repr(C)]
pub struct Path { /* private fields */ }
Expand description

A path value used to locate objects in layers or scenegraphs.

Overview

Path is used in several ways:

  • As a storage key for addressing and accessing values held in a Layer
  • As a namespace identity for scenegraph objects
  • As a way to refer to other scenegraph objects through relative paths

The paths represented by an Path class may be either relative or absolute. Relative paths are relative to the prim object that contains them (that is, if an RelationshipSpec target is relative, it is relative to the SdfPrimSpec object that owns the RelationshipSpec object).

Path objects can be readily created from and converted back to strings, but as Path objects, they have behaviors that make it easy and efficient to work with them. The Path class provides a full range of methods for manipulating scene paths by appending a namespace child, appending a relationship target, getting the parent path, and so on. Since the Path class uses a node-based representation internally, you should use the editing functions rather than converting to and from strings if possible.

Path Syntax

Like a filesystem path, an Path is conceptually just a sequence of path components. Unlike a filesystem path, each component has a type, and the type is indicated by the syntax.

Two separators are used between parts of a path. A slash (“/”) following an identifier is used to introduce a namespace child. A period (“.”) following an identifier is used to introduce a property. A property may also have several non-sequential colons (‘:’) in its name to provide a rudimentary namespace within properties but may not end or begin with a colon.

A leading slash in the string representation of an Path object indicates an absolute path. Two adjacent periods indicate the parent namespace.

Brackets (“[” and “]”) are used to indicate relationship target paths for relational attributes.

The first part in a path is assumed to be a namespace child unless it is preceded by a period. That means:

  • /Foo is an absolute path specifying the root prim Foo.
  • /Foo/Bar is an absolute path specifying namespace child Bar of root prim Foo.
  • /Foo/Bar.baz is an absolute path specifying property \c baz of namespace child Bar of root prim Foo.
  • Foo is a relative path specifying namespace child Foo of the current prim.
  • Foo/Bar is a relative path specifying namespace child Bar of namespace child Foo of the current prim.
  • Foo/Bar.baz is a relative path specifying property \c baz of namespace child Bar of namespace child Foo of the current prim.
  • .foo is a relative path specifying the property \c foo of the current prim.
  • /Foo.bar[/Foo.baz].attrib is a relational attribute path. The relationship /Foo.bar has a target /Foo.baz. There is a relational attribute attrib on that relationship->;target pair.

A Note on Thread-Safety

Path is strongly thread-safe, in the sense that zero additional synchronization is required between threads creating or using Path values. Just like tf.Token, Path values are immutable. Internally, Path uses a global prefix tree to efficiently share representations of paths, and provide fast equality/hashing operations, but modifications to this table are internally synchronized. Consequently, as with tf.Token, for best performance it is important to minimize the number of values created (since it requires synchronized access to this table) or copied (since it requires atomic ref-counting operations).

Implementations§

source§

impl Path

source

pub fn get_text(&self) -> Result<&str>

Returns the string representation of this path as a c string.

This function returns a pointer to a persistent c string.

This function is recommended only for human-readable or diagnostic output. Use the Path API to manipulate paths. It is less error-prone and has better performance.

Trait Implementations§

source§

impl Clone for Path

source§

fn clone(&self) -> Self

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 Default for Path

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Display for Path

source§

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

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

impl Drop for Path

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl TryFrom<&str> for Path

§

type Error = Error

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

fn try_from(value: &str) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl RefUnwindSafe for Path

§

impl Send for Path

§

impl Sync for Path

§

impl Unpin for Path

§

impl UnwindSafe for Path

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> ToOwned for Twhere 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
source§

impl<T> ToString for Twhere 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 Twhere 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 Twhere 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.