pub struct Path {
pub span: Span,
pub id: NodeID,
/* private fields */
}Expand description
A Path in a program.
Fields§
§span: SpanA span locating where the path occurred in the source.
id: NodeIDThe ID of the node.
Implementations§
Source§impl Path
impl Path
pub fn new( qualifier: Vec<Identifier>, identifier: Identifier, absolute_path: Option<Vec<Symbol>>, span: Span, id: NodeID, ) -> Self
pub fn identifier(&self) -> Identifier
pub fn qualifier(&self) -> &[Identifier]
Sourcepub fn as_symbols(&self) -> Vec<Symbol>
pub fn as_symbols(&self) -> Vec<Symbol>
Returns a Vec<Symbol> representing the full symbolic path:
the qualifier segments followed by the final identifier.
Note: this refers to the user path which is not necessarily the absolute path.
Sourcepub fn try_absolute_path(&self) -> Option<&[Symbol]>
pub fn try_absolute_path(&self) -> Option<&[Symbol]>
Returns an optional slice of Symbols representing the resolved absolute path,
or None if resolution has not yet occurred.
Sourcepub fn absolute_path(&self) -> &[Symbol]
pub fn absolute_path(&self) -> &[Symbol]
Returns a slice of Symbols representing the resolved absolute path.
§Panics
Panics if the absolute path has not been resolved yet. This is expected to be called only after path resolution has occurred.
Sourcepub fn with_updated_last_symbol(self, new_symbol: Symbol) -> Self
pub fn with_updated_last_symbol(self, new_symbol: Symbol) -> Self
Returns a new Path instance with the last segment’s Symbol and the last symbol
in the absolute_path (if present) replaced with new_symbol.
Other fields remain unchanged.
Sourcepub fn with_absolute_path(self, absolute_path: Option<Vec<Symbol>>) -> Self
pub fn with_absolute_path(self, absolute_path: Option<Vec<Symbol>>) -> Self
Sets self.absolute_path to absolute_path
Sourcepub fn with_module_prefix(self, module_prefix: &[Symbol]) -> Self
pub fn with_module_prefix(self, module_prefix: &[Symbol]) -> Self
Sets the absolute_path by prepending the given module_prefix to the path’s
own qualifier and identifier. Returns the updated Path.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Path
impl<'de> Deserialize<'de> for Path
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<Identifier> for Path
impl From<Identifier> for Path
Source§fn from(value: Identifier) -> Self
fn from(value: Identifier) -> Self
Source§impl From<Path> for Expression
impl From<Path> for Expression
impl Eq for Path
impl StructuralPartialEq for Path
Auto Trait Implementations§
impl Freeze for Path
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> 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
fn take_from_value<D>(
value: &mut Value,
field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.