pub trait CriBase {
    type Scheme<'a>: Scheme
    where
        Self: 'a
; type Host<'a>: Host
    where
        Self: 'a
; type PathItem<'a>: TextOrPet<PATH_UE>
    where
        Self: 'a
; type QueryItem<'a>: TextOrPet<QUERY_UE>
    where
        Self: 'a
; type FragmentItem<'a>: TextOrPet<FRAGMENT_UE>
    where
        Self: 'a
; type UserInfoItem<'a>: TextOrPet<HOST_UE>
    where
        Self: 'a
; type PathIter<'a>: Iterator<Item = Self::PathItem<'a>> + ExactSizeIterator
    where
        Self: 'a
; type QueryIter<'a>: Iterator<Item = Self::QueryItem<'a>>
    where
        Self: 'a
; fn path(&self) -> Self::PathIter<'_>; fn query(&self) -> Self::QueryIter<'_>; fn fragment(&self) -> Option<Self::FragmentItem<'_>>; fn userinfo(&self) -> Option<Self::UserInfoItem<'_>>; fn host(&self) -> Self::Host<'_>; fn port(&self) -> Option<u16>; }
Expand description

Commonalities between CriRef and Cri

This interface comes with no error handling, as it assumes that the underlying object is a CRI. When processing a received unchecked CRI, see [AllegedCri] for an example of how to handle that.

Invariants

The accessor based interface shown here does not inherently map some of the invariants that the model is built on, and that are enforced by the CDDL syntax. All implementations are expected to adhere to them, but (being safe to implenent), users can not declare code unreachable based on them, and are expected to either panic if they run into unexpected situations. (Most users will likely not observe the malbehavior, as for example they won’t even query the port once they find no host). Likewise, implementations may panic if components are accessed that can not be present as per other components’ output.

For implementers:

  • The host (and port) is only accessed if it is indicated that they are available.

For users:

  • There can only be Some port if there is a host.

Required Associated Types

Required Methods

Implementors