Skip to main content

Url

Struct Url 

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

(url feature) Accepts a URL, optionally restricting the scheme and requiring a host.

Implementations§

Source§

impl Url

Source

pub fn with_meta(self, meta: Meta) -> Self

Attach human-facing metadata (name, description, examples, default, output conversion).

Source

pub fn new() -> Self

Source

pub fn schemes( self, schemes: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Restrict to the given schemes, e.g. Url::new().schemes(["http", "https"]).

Source

pub fn require_host(self) -> Self

Require the URL to have a host component.

Trait Implementations§

Source§

impl Clone for Url

Source§

fn clone(&self) -> Url

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 Url

Source§

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

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

impl Default for Url

Source§

fn default() -> Url

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

impl Validator for Url

Source§

fn meta(&self) -> &Meta

This validator’s human-facing metadata.
Source§

fn meta_mut(&mut self) -> &mut Meta

Mutable access to this validator’s metadata (backs the WithMeta builder setters).
Source§

fn check(&self, value: &mut Value) -> Result<(), Error>

The validation rule: check (and coerce) value in place.
Source§

fn validate(&self, value: &mut Value) -> Result<(), Error>

Run check; on error attach this validator’s Meta (innermost wins); on success apply the output conversion in meta().convert, if any.

Auto Trait Implementations§

§

impl Freeze for Url

§

impl RefUnwindSafe for Url

§

impl Send for Url

§

impl Sync for Url

§

impl Unpin for Url

§

impl UnsafeUnpin for Url

§

impl UnwindSafe for Url

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 = 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.
Source§

impl<T> WithMeta for T
where T: Validator,

Source§

fn name(&self) -> &str

The human-readable name.
Source§

fn description(&self) -> Option<&str>

The description, if any.
Source§

fn examples(&self) -> &[(Value, Option<String>)]

The example values (each with an optional note).
Source§

fn default_value(&self) -> Option<&Value>

The default value, if any.
Source§

fn convert(&self) -> Option<ValueType>

The output conversion target, if any.
Source§

fn with_name(self, name: impl Into<String>) -> Self

Set the human-readable name (surfaced in error messages).
Source§

fn with_description(self, text: impl Into<String>) -> Self

Attach a human-readable description.
Source§

fn with_example(self, value: impl Into<Value>) -> Self

Add an example value.
Source§

fn with_example_noted( self, value: impl Into<Value>, note: impl Into<String>, ) -> Self

Add an example value with an explanatory note.
Source§

fn with_default(self, value: impl Into<Value>) -> Self

Set the default value used as an on-error fallback (see the pipeline’s validate stage).
Source§

fn to_string(self) -> Self

After validation succeeds, cast the value to a string.
Source§

fn to_int(self) -> Self

After validation succeeds, cast the value to an integer.
Source§

fn to_float(self) -> Self

After validation succeeds, cast the value to a float.
Source§

fn to_bool(self) -> Self

After validation succeeds, cast the value to a boolean.