pub struct Endpoint { /* private fields */ }Expand description
An endpoint is a representation of a Thumbor image URL.
§Usage
EndpointBuilder is used to create an Endpoint instance.
You can then use the Endpoint::to_url method to generate the URL,
or the Endpoint::to_path method to get the path (without the server origin).
The format of the image URI depends heavily on the image loader you are using. Thumbor comes pre-packaged with an HTTP loader and a Filesystem loader.
- If you use the HTTP loader, the URI corresponds to the image complete URI.
- If you use the Filesystem loader, the URI corresponds to the path of the image from the images root.
Implementations§
source§impl Endpoint
impl Endpoint
sourcepub fn to_path(&self, image_uri: &str) -> String
pub fn to_path(&self, image_uri: &str) -> String
use thumbor::Server;
let server = Server::new_unsafe("http://localhost:8888");
let endpoint = server.endpoint_builder().build();
let path = endpoint.to_path("path/to/my/image.jpg");
assert_eq!(path, "/unsafe/path/to/my/image.jpg");sourcepub fn to_url(&self, image_uri: &str) -> String
pub fn to_url(&self, image_uri: &str) -> String
use thumbor::Server;
let server = Server::new_unsafe("http://localhost:8888");
let endpoint = server.endpoint_builder().build();
let path = endpoint.to_url("path/to/my/image.jpg");
assert_eq!(path, "http://localhost:8888/unsafe/path/to/my/image.jpg");source§impl Endpoint
impl Endpoint
sourcepub fn with_server(server: Server) -> EndpointBuilder
pub fn with_server(server: Server) -> EndpointBuilder
Create an instance of Endpoint using the builder syntax
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Endpoint
impl RefUnwindSafe for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl UnwindSafe for Endpoint
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more