Struct spot::Spot [−][src]
Implementations
impl Spot
[src]
pub fn new(amount_of_threads: usize) -> Spot
[src]
Returns a Spot HTTP server instance with worker threads equal to the specified amount.
#Panics
panics if amount of threads is 0
pub fn middle(
&mut self,
path: &str,
function: fn(_: Request, _: Response) -> (Request, Response, bool)
)
[src]
&mut self,
path: &str,
function: fn(_: Request, _: Response) -> (Request, Response, bool)
)
Add middleware for specified resources.
The middleware function takes inn a function that returns a modified response and request, aswell as a boolean is true if the request should be forwarded or false if you wish the server to write the current response.
pub fn route(
&mut self,
path: &str,
function: fn(_: Request, _: Response) -> Response
)
[src]
&mut self,
path: &str,
function: fn(_: Request, _: Response) -> Response
)
Add a http resource route which takes in the request and a premade respons, then returns a modifed response that is written to the client
pub fn route_file(&mut self, path: &str)
[src]
Add a file to routes, it’s route is equal to the path where the file lies
pub fn public(&mut self, dir_name: &str)
[src]
Make all the files in the specified directory publicly avalible
pub fn bind(&mut self, ip: &str) -> String
[src]
Bind the server to the specified IP address and listen for inncomming http requests
Auto Trait Implementations
impl RefUnwindSafe for Spot
impl Send for Spot
impl Sync for Spot
impl Unpin for Spot
impl UnwindSafe for Spot
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,
pub 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.
pub 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>,