Parts

Struct Parts 

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

Represents a collection of parts in the ERN (Entity Resource Name), handling multiple segments.

Implementations§

Source§

impl Parts

Source

pub fn new(f0: Vec<Part>) -> Self

Constructs a new Parts.

Source§

impl Parts

Source

pub fn add_part<T>(self, part: T) -> Result<Self, ErnError>
where T: Into<Part>,

Adds a part to the collection.

§Arguments
  • part - The Part to be added to the collection. Adds a part to the collection with validation.
§Arguments
  • part - The Part to be added to the collection.
§Validation Rules
  • Maximum of 10 parts allowed in a single Parts collection
§Returns
  • Result<Parts, ErnError> - The updated Parts collection or an error
Source

pub fn into_owned(self) -> Parts

Converts the Parts into an owned version with ’static lifetime

Source

pub fn len(&self) -> usize

Returns the number of parts in the collection.

Source

pub fn is_empty(&self) -> bool

Returns true if the collection is empty.

Trait Implementations§

Source§

impl Clone for Parts

Source§

fn clone(&self) -> Parts

Returns a duplicate 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 Debug for Parts

Source§

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

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

impl Default for Parts

Source§

fn default() -> Parts

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

impl Display for Parts

Source§

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

Formats the collection of parts as a string, joining them with ‘/’.

Source§

impl ErnComponent for Parts

Implementation for the Parts component of an ERN.

The Parts component represents a collection of path parts in the ERN. Its NextState is itself, allowing for multiple parts to be added.

Source§

type NextState = Parts

The type of the next component that should follow this one in the ERN structure. Read more
Source§

fn prefix() -> &'static str

Returns the prefix string that should appear before this component in an ERN. Read more
Source§

impl FromIterator<Part> for Parts

Source§

fn from_iter<T: IntoIterator<Item = Part>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl Hash for Parts

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<'a> IntoIterator for &'a Parts

Source§

type Item = &'a Part

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Part>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoIterator for Parts

Source§

type Item = Part

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<<Parts as IntoIterator>::Item>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for Parts

Source§

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

Source§

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

Source§

impl StructuralPartialEq for Parts

Auto Trait Implementations§

§

impl Freeze for Parts

§

impl RefUnwindSafe for Parts

§

impl Send for Parts

§

impl Sync for Parts

§

impl Unpin for Parts

§

impl UnwindSafe for Parts

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

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

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

Source§

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

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.