pub struct ApiRouteBuilder<'a> { /* private fields */ }
Trait Implementations§
Source§impl<'a> RouteBuilder<'a> for ApiRouteBuilder<'a>
impl<'a> RouteBuilder<'a> for ApiRouteBuilder<'a>
Source§fn build(self) -> Result<Uri, Error>
fn build(self) -> Result<Uri, Error>
Tries to build a URI from path arguments and parameters.
use crate::uri_routes::{RouteBuilder, ApiRouteBuilder};
let route = ApiRouteBuilder::new("google.com").build().unwrap();
assert_eq!(route, "https://google.com")
Source§fn with_param<T: ToString>(self, name: String, value: T) -> Self
fn with_param<T: ToString>(self, name: String, value: T) -> Self
Add a parameter key/pair to the builder.
use crate::uri_routes::{RouteBuilder, ApiRouteBuilder};
let route = ApiRouteBuilder::new("fqdm.org")
.with_param("page".into(), 1)
.build()
.unwrap();
assert_eq!(route, "https://fqdm.org?page=1")
Source§fn with_path(self, path: String) -> Self
fn with_path(self, path: String) -> Self
Add a path argument to the end of the path buffer.
use crate::uri_routes::{RouteBuilder, ApiRouteBuilder};
let route = ApiRouteBuilder::new("fqdm.org")
.with_path("resource".into())
.build()
.unwrap();
assert_eq!(route, "https://fqdm.org/resource")
Source§fn with_path_weight(self, path: String, weight: f32) -> Self
fn with_path_weight(self, path: String, weight: f32) -> Self
Inserts a path argument with the desired weight.
use crate::uri_routes::{RouteBuilder, ApiRouteBuilder};
let route = ApiRouteBuilder::new("fqdm.org")
.with_path_weight("resource0".into(), 2.0)
.with_path_weight("resource1".into(), 1.0)
.build()
.unwrap();
assert_eq!(route, "https://fqdm.org/resource1/resource0")
Source§fn with_scheme(self, scheme: String) -> Self
fn with_scheme(self, scheme: String) -> Self
Tries to build a URI from path arguments and parameters.
use crate::uri_routes::{RouteBuilder, ApiRouteBuilder};
let route = ApiRouteBuilder::new("localhost")
.with_scheme("file".into())
.build()
.unwrap();
assert_eq!(route, "file://localhost")
Auto Trait Implementations§
impl<'a> Freeze for ApiRouteBuilder<'a>
impl<'a> RefUnwindSafe for ApiRouteBuilder<'a>
impl<'a> Send for ApiRouteBuilder<'a>
impl<'a> Sync for ApiRouteBuilder<'a>
impl<'a> Unpin for ApiRouteBuilder<'a>
impl<'a> UnwindSafe for ApiRouteBuilder<'a>
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