Struct Builder
pub struct Builder { /* private fields */ }
A builder for Uris.
This type can be used to construct an instance of Uri
through a builder pattern.
Implementations
impl Builder
fn new() -> BuilderCreates a new default instance of
Builderto construct aUri.Examples
# use *; let uri = new .scheme .authority .path_and_query .build .unwrap;fn scheme<T>(self, scheme: T) -> Self where T: TryInto<Scheme>, <T as TryInto<Scheme>>::Error: Into<Error>,Set the
Schemefor this URI.Examples
# use *; let mut builder = new; builder.scheme;Set the
Authorityfor this URI.Examples
# use *; let uri = new .authority .build .unwrap;fn path_and_query<T>(self, p_and_q: T) -> Self where T: TryInto<PathAndQuery>, <T as TryInto<PathAndQuery>>::Error: Into<Error>,Set the
PathAndQueryfor this URI.Examples
# use *; let uri = new .path_and_query .build .unwrap;fn build(self) -> Result<Uri, Error>Consumes this builder, and tries to construct a valid
Urifrom the configured pieces.Errors
This function may return an error if any previously configured argument failed to parse or get converted to the internal representation. For example if an invalid
schemewas specified viascheme("!@#%/^")the error will be returned when this function is called rather than whenschemewas called.Additionally, the various forms of URI require certain combinations of parts to be set to be valid. If the parts don't fit into any of the valid forms of URI, a new error is returned.
Examples
# use *; let uri = builder .build .unwrap;
Trait Implementations
impl Debug for Builder
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Builder
fn default() -> Builder
impl From<Uri> for Builder
fn from(uri: Uri) -> Self
Auto Trait Implementations
impl !Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnsafeUnpin for Builder
impl UnwindSafe for Builder
Blanket Implementations
impl<T> Any for Builder
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Builder
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Builder
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Builder
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for Builder
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Builder
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Builder
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>