pub struct App<S = ()> { /* private fields */ }
Expand description
🖥️ A Fluffer App
§Defaults
- Key:
./key.pem
- Cert:
./cert.pem
- Address:
127.0.0.1:1965
(or theADDRESS
environment variable)
App::default()
.route("/", |_| async { "Hello :>" })
.run()
Implementations§
Source§impl<S> App<S>
impl<S> App<S>
Sourcepub fn route(
self,
path: &str,
func: impl GemCall<S> + 'static + Sync + Send,
) -> Self
pub fn route( self, path: &str, func: impl GemCall<S> + 'static + Sync + Send, ) -> Self
Takes a generic function that implements GemCall
, and boxes it into our routes
hashmap.
Will panic if an insert error occurs.
Sourcepub fn not_found(self, message: impl Into<String>) -> Self
pub fn not_found(self, message: impl Into<String>) -> Self
Update the message displayed when a page isn’t found.
Sourcepub fn path_to_cert(self, path: impl Into<PathBuf>) -> Self
pub fn path_to_cert(self, path: impl Into<PathBuf>) -> Self
Update certificate path.
Sourcepub fn path_to_key(self, path: impl Into<PathBuf>) -> Self
pub fn path_to_key(self, path: impl Into<PathBuf>) -> Self
Update key path.
Sourcepub fn titan(
self,
path: &str,
func: impl GemCall<S> + 'static + Sync + Send,
max_size: usize,
) -> Self
pub fn titan( self, path: &str, func: impl GemCall<S> + 'static + Sync + Send, max_size: usize, ) -> Self
The same as App::route
, but with titan enabled.
When the request’s content exceeds max_size
, a PermanentFailure
is met.
Set max_size
to 0 to disable this behaviour.
Will panic if an insert error occurs.
Sourcepub fn state<T: Send + Sync + Clone>(self, state: T) -> App<T>
pub fn state<T: Send + Sync + Clone>(self, state: T) -> App<T>
Replace App
’s unit state with State.
pub async fn run(self) -> Result<(), AppErr>
Trait Implementations§
Auto Trait Implementations§
impl<S = ()> !Freeze for App<S>
impl<S = ()> !RefUnwindSafe for App<S>
impl<S> Send for App<S>where
S: Send,
impl<S> Sync for App<S>where
S: Sync,
impl<S> Unpin for App<S>where
S: Unpin,
impl<S = ()> !UnwindSafe for App<S>
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