PathSlice

Struct PathSlice 

Source
pub struct PathSlice(/* private fields */);
Expand description

A qualified identifier: foo.bar.baz.

This is a list of identifiers, and is never empty.

Implementations§

Source§

impl PathSlice

Source

pub fn from_ref(segment: &Ident) -> &Self

Creates a new path from a single ident.

Source

pub fn from_mut(segment: &mut Ident) -> &mut Self

Creates a new path from a single ident.

Source

pub fn from_slice(segments: &[Ident]) -> &Self

Creates a new path from a slice of segments.

§Panics

Panics if segments is empty.

Source

pub unsafe fn from_slice_unchecked(segments: &[Ident]) -> &Self

Creates a new path from a slice of segments.

§Safety

The caller must ensure that segments is not empty.

Source

pub fn from_mut_slice(segments: &mut [Ident]) -> &mut Self

Creates a new path from a mutable slice of segments.

§Panics

Panics if segments is empty.

Source

pub unsafe fn from_mut_slice_unchecked(segments: &mut [Ident]) -> &mut Self

Creates a new path from a mutable slice of segments.

§Safety

The caller must ensure that segments is not empty.

Source

pub fn span(&self) -> Span

Returns the path’s span.

Source

pub fn segments(&self) -> &[Ident]

Returns the path’s segments.

Source

pub fn segments_mut(&mut self) -> &mut [Ident]

Returns the path’s segments.

Source

pub fn get_ident(&self) -> Option<&Ident>

If this path consists of a single ident, returns the ident.

Source

pub fn get_ident_mut(&mut self) -> Option<&mut Ident>

If this path consists of a single ident, returns the ident.

Source

pub fn first(&self) -> &Ident

Returns the first segment of the path.

Source

pub fn first_mut(&mut self) -> &mut Ident

Returns the first segment of the path.

Source

pub fn last(&self) -> &Ident

Returns the last segment of the path.

Source

pub fn last_mut(&mut self) -> &mut Ident

Returns the last segment of the path.

Trait Implementations§

Source§

impl Borrow<PathSlice> for Path

Source§

fn borrow(&self) -> &PathSlice

Immutably borrows from an owned value. Read more
Source§

impl Debug for PathSlice

Source§

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

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

impl Display for PathSlice

Source§

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

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

impl Hash for PathSlice

Source§

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

Feeds this value into the given Hasher. Read more
Source§

impl Ord for PathSlice

Source§

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

This method returns an Ordering between self and other. Read more
Source§

impl PartialEq<Ident> for PathSlice

Source§

fn eq(&self, other: &Ident) -> 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 PartialEq<Symbol> for PathSlice

Source§

fn eq(&self, other: &Symbol) -> 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 PartialEq for PathSlice

Source§

fn eq(&self, other: &PathSlice) -> 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 PathSlice

Source§

fn partial_cmp(&self, other: &PathSlice) -> 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 ToOwned for PathSlice

Source§

type Owned = Path

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§

fn clone_into(&self, target: &mut Self::Owned)

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

impl Eq for PathSlice

Source§

impl StructuralPartialEq for PathSlice

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> 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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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

Compare self to key and return their ordering.
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<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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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

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<Q> ToOwnedEquivalent<<Q as ToOwned>::Owned> for Q
where Q: ToOwned + Eq + ?Sized,

Source§

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

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: (unsized)