Struct rpki::uri::Https

source ·
pub struct Https { /* private fields */ }
Expand description

A simple HTTPS URI.

This is only a slim wrapper around a Bytes value ensuring that the scheme is "https".

Implementations§

source§

impl Https

source

pub fn from_string(s: String) -> Result<Self, Error>

source

pub fn from_slice(slice: &[u8]) -> Result<Self, Error>

source

pub fn from_bytes(bytes: Bytes) -> Result<Self, Error>

source

pub fn unshare(&mut self)

Moves the URI to its own memory.

Values use shared memory in order to allow cheap copying which may result in large allocations being kept around longer than necessary. This method moves the URI to a new memory location allowing the previous location to potentially be freed.

source

pub fn as_slice(&self) -> &[u8]

Returns a octets slice reference of the URI.

source

pub fn as_str(&self) -> &str

Returns a string reference of the URI.

source

pub fn scheme(&self) -> Scheme

source

pub fn authority(&self) -> &str

Returns the URI’s authority part as a string slice.

source

pub fn canonical_authority(&self) -> Cow<'_, str>

Returns a canonical version of authority part.

Since host names are case-insensitive, the authority part can be provided in different ways. This returns a version of the authority with all ASCII letters in lowercase.

source

pub fn encode_general_name(&self) -> impl Values + '_

source

pub fn path(&self) -> &str

Returns the URI’s path as a string slice.

The path does not start with a slash. As a consequence, an empty path results in an empty string.

source

pub fn join(&self, path: &[u8]) -> Result<Self, Error>

This function will join this URI and the given path. If the current URI does not end with a trailing ‘/’, it will be injected.

source

pub fn parent(&self) -> Option<Self>

Returns the parent URI.

The parent URI is the URI with the last path segment removed. If a URI has no path segment, the method returns None. If a URI is returned, it’s path will have a trailing slash to indicate that it is a directory.

Keep in mind that a URI with an empty path will still have the module name after the authority part. The method will never return a URI with an empty module name.

source

pub fn eq_authority(&self, other: &Self) -> bool

Returns whether the two URIs have the same authority.

Trait Implementations§

source§

impl<'a> Arbitrary<'a> for Https

source§

fn arbitrary(u: &mut Unstructured<'_>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
source§

impl AsRef<[u8]> for Https

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Bytes> for Https

source§

fn as_ref(&self) -> &Bytes

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<str> for Https

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Https

source§

fn clone(&self) -> Https

Returns a copy 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 Https

source§

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

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

impl<'de> Deserialize<'de> for Https

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Https

source§

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

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

impl From<Https> for TalUri

source§

fn from(uri: Https) -> Self

Converts to this type from the input type.
source§

impl FromStr for Https

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Error>

Parses a string s to return a value of this type. Read more
source§

impl Hash for Https

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 Https

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PrimitiveContent for &'a Https

source§

const TAG: Tag = Tag::IA5_STRING

The natural tag of an encoded value of this type.
source§

fn encoded_len(&self, _: Mode) -> usize

Returns the length of the encoded content of this type.
source§

fn write_encoded<W: Write>( &self, _mode: Mode, target: &mut W, ) -> Result<(), Error>

Writes the encoded content to a writer.
source§

fn to_encoded_bytes(&self, mode: Mode) -> Bytes

Encodes the value to bytes (useful when you need to sign a structure)
source§

fn encode(self) -> Primitive<Self>

Returns a value encoder for this content using the natural tag. Read more
source§

fn encode_as(self, tag: Tag) -> Primitive<Self>

Returns a value encoder for this content using the given tag. Read more
source§

fn encode_ref(&self) -> Primitive<&Self>

Returns a value encoder for a reference using the natural tag.
source§

fn encode_ref_as(&self, tag: Tag) -> Primitive<&Self>

Returns a value encoder for a reference using the given tag.
source§

impl Serialize for Https

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<String> for Https

§

type Error = Error

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

fn try_from(s: String) -> Result<Self, Error>

Performs the conversion.
source§

impl Eq for Https

Auto Trait Implementations§

§

impl !Freeze for Https

§

impl RefUnwindSafe for Https

§

impl Send for Https

§

impl Sync for Https

§

impl Unpin for Https

§

impl UnwindSafe for Https

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> 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> Text for T
where T: Display,

source§

fn write_escaped( &self, mode: TextEscape, target: &mut impl Write, ) -> Result<(), Error>

Write text escaped for the given mode to target.
source§

fn write_raw(&self, target: &mut impl Write) -> Result<(), Error>

Write text as is to target.
source§

fn write_base64(&self, target: &mut impl Write) -> Result<(), Error>

Write text encoded in BASE64 to target.
source§

impl<T> ToOwned for T
where T: Clone,

§

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§

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

§

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

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,