Skip to main content

SiteRoot

Struct SiteRoot 

Source
pub struct SiteRoot { /* private fields */ }
Expand description

The path one site reaches its published stamp by.

Structurally non-empty, and read the way the language reads a path: qualifiers only at the root — crate, self, or a leading run of super — and an item name at every later step, so a root the consumer’s compiler would read as something else is not a value anybody can hold. Usually one segment: the crate the stamp is published in names its own root, and a site elsewhere names that crate.

Implementations§

Source§

impl SiteRoot

Source

pub fn spelled(segments: Vec<String>) -> Result<Self, StampError>

The path one site reaches its stamp by, parsed from the segments the caller stated.

§Errors

Returns StampError::NotAnIdentifier where a segment cannot name a step of a site’s path, StampError::PathEmpty where no segment was stated, and StampError::PathUnbounded where the segments outgrow the declared magnitude.

The checks are in that order, so exactly one cause is true of any refused root. The reading is position-aware the way the language’s own path grammar is: the root position admits the qualifiers a site lawfully roots itself under — crate, self, or a leading run of super — and every segment past the qualifiers names an item, read against the composed law that refuses the keyword roster.

Source

pub fn segments(&self) -> &NonEmpty<String, PATH_SEGMENT_LIMIT>

The segments, in the order they were stated; structurally at least one.

Source

pub fn count(&self) -> usize

How many segments the root carries; structurally at least one.

Trait Implementations§

Source§

impl Clone for SiteRoot

Source§

fn clone(&self) -> SiteRoot

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SiteRoot

Source§

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

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

impl Eq for SiteRoot

Source§

impl Hash for SiteRoot

Source§

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

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 PartialEq for SiteRoot

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SiteRoot

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.