Struct scratch_server::Router
source · pub struct Router { /* private fields */ }
Implementations§
source§impl Router
impl Router
pub fn new() -> Self
pub fn with_logger(self, logger: Option<Arc<Logger>>) -> Self
pub fn with_cors(self, cors: Cors) -> Self
pub fn with_credentials(self, password: &str, username: &str) -> Self
pub fn add_route<F>( &mut self, path: &str, method: HttpMethod, handler: F, authorize: bool, )
pub fn route( &self, path: &str, method: &str, data: Option<&str>, peer_addr: IpAddr, headers: &HashMap<&str, &str>, ) -> Result<HttpResponse, ApiError>
pub fn log_response( &self, status_code: u16, path: &str, method: &str, peer_addr: IpAddr, ) -> Result<(), Box<dyn Error>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Router
impl !RefUnwindSafe for Router
impl Send for Router
impl Sync for Router
impl Unpin for Router
impl !UnwindSafe for Router
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