[−][src]Struct imgix::Url
Primary structure used to generate imgix URLs.
An imgix URL is comprised of four components:
- scheme - the scheme being used (https by default).
- domain - the imgix domain, i.e. example.imgix.net.
- path - the path to the image file.
- query - the query string constructed from
params
.
domain
┌──────┴──────┐
https://www.example.com/image/path.png/?w=320&h=640
└─┬─┘ └──────┬───────┘ └────┬────┘
scheme path params
Methods
impl Url
[src]
pub fn new(domain: &'static str) -> Self
[src]
Constructs a new Url
given a domain.
Panics
This constructor will fail if the domain
is an empty string.
pub fn domain(self, h: &str) -> Self
[src]
Sets the domain value (i.e. "example.domain.com").
Panics
This method panics if the domain h
is an empty string.
pub fn path(self, r: &str) -> Self
[src]
Sets the path value to the image file (i.e. 'image/path.png').
Panics
This method panics if the path string r
is empty (i.e. "").
pub fn param(self, k: &'static str, v: &'static str) -> Self
[src]
Sets an arbitrary key-value parameter (i.e. k='w', v='100' or k='fit', v='crop').
Panics
This method panics if the key k
or the value v
is an empty string.
pub fn params(self, p: &[(&'static str, &'static str)]) -> Self
[src]
Sets an arbitrary number of key-value parameters.
Panics
This method panics if any key k
or any value v
is an empty string.
pub fn lib(self, l: &str) -> Self
[src]
Sets the lib
or library.
pub fn token(self, token: &str) -> Self
[src]
Sets the signing token
.
pub fn scheme(self, s: Scheme) -> Self
[src]
pub fn join(&self) -> String
[src]
Joins the components of a Url
(i.e. scheme
+ domain
+ path
+
params
) where the resulting string has the following form:
{scheme}://{domain}/{path}?{lib}{query}
This function will only join
the components of a Url
if a path
has been specified.
Panics
This function will panic if the image path
has not been specified.
(i.e. if the path
is None
).
pub fn join_params(p: &[(&'static str, &'static str)]) -> String
[src]
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Url
impl Send for Url
impl Sync for Url
impl Unpin for Url
impl UnwindSafe for Url
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,