pub struct Context(/* private fields */);Implementations§
Source§impl Context
impl Context
pub fn from_stream_request_log( stream: &ArcRwLockStream, request: &Request, log: &Log, ) -> Self
pub async fn get_stream(&self) -> OptionArcRwLockStream
pub async fn get_request(&self) -> Request
pub async fn get_response(&self) -> Response
pub async fn get_request_string(&self) -> String
pub async fn get_response_string(&self) -> String
pub async fn get_log(&self) -> Log
pub async fn get_socket_addr(&self) -> OptionSocketAddr
pub async fn get_socket_addr_or_default(&self) -> SocketAddr
pub async fn get_socket_addr_string(&self) -> OptionString
pub async fn get_socket_addr_or_default_string(&self) -> String
pub async fn get_socket_host(&self) -> OptionSocketHost
pub async fn get_route_params_lock( &self, ) -> ArcRwLock<HashMap<String, String, BuildHasherDefault<XxHash3_64>>>
pub async fn get_route_params( &self, ) -> HashMap<String, String, BuildHasherDefault<XxHash3_64>>
pub async fn get_route_param(&self, name: &str) -> Option<String>
pub async fn get_socket_port(&self) -> OptionSocketPort
pub async fn send_response<T: Into<ResponseBody>>( &self, status_code: usize, response_body: T, ) -> ResponseResult
pub async fn send(&self) -> ResponseResult
pub async fn send_response_once<T: Into<ResponseBody>>( &self, status_code: usize, response_body: T, ) -> ResponseResult
pub async fn send_once(&self) -> ResponseResult
pub async fn send_response_body<T: Into<ResponseBody>>( &self, response_body: T, ) -> ResponseResult
pub async fn send_body(&self) -> ResponseResult
pub async fn close(&self) -> ResponseResult
pub async fn flush(&self) -> ResponseResult
pub async fn set_log(&self, log: Log) -> &Self
pub async fn log_info<T, L>(&self, data: T, func: L) -> &Selfwhere
T: ToString,
L: LogFuncTrait<T>,
pub async fn log_debug<T, L>(&self, data: T, func: L) -> &Selfwhere
T: ToString,
L: LogFuncTrait<T>,
pub async fn log_error<T, L>(&self, data: T, func: L) -> &Selfwhere
T: ToString,
L: LogFuncTrait<T>,
pub async fn async_log_info<T, L>(&self, data: T, func: L) -> &Selfwhere
T: ToString,
L: LogFuncTrait<T>,
pub async fn async_log_debug<T, L>(&self, data: T, func: L) -> &Selfwhere
T: ToString,
L: LogFuncTrait<T>,
pub async fn async_log_error<T, L>(&self, data: T, func: L) -> &Selfwhere
T: ToString,
L: LogFuncTrait<T>,
pub async fn get_request_method(&self) -> RequestMethod
pub async fn get_request_host(&self) -> RequestHost
pub async fn get_request_path(&self) -> RequestPath
pub async fn get_request_querys(&self) -> RequestQuerys
pub async fn get_request_query<T: Into<RequestHeadersKey>>( &self, key: T, ) -> OptionRequestQuerysValue
pub async fn get_request_body(&self) -> RequestBody
pub async fn get_request_body_string(&self) -> String
pub async fn get_request_body_json<T>(&self) -> ResultSerdeJsonError<T>where
T: DeserializeOwned,
pub async fn get_request_header<K>(&self, key: K) -> OptionRequestHeadersValuewhere
K: Into<RequestHeadersKey>,
pub async fn get_request_headers(&self) -> RequestHeaders
pub async fn get_request_upgrade_type(&self) -> UpgradeType
pub async fn set_request(&self, request_data: Request) -> &Self
pub async fn set_request_method<T>(&self, method: T) -> &Selfwhere
T: Into<RequestMethod>,
pub async fn set_request_host<T>(&self, host: T) -> &Selfwhere
T: Into<RequestHost>,
pub async fn set_request_path<T>(&self, path: T) -> &Selfwhere
T: Into<RequestPath>,
pub async fn set_request_query<K, V>(&self, key: K, value: V) -> &Self
pub async fn set_request_querys<T>(&self, querys: T) -> &Selfwhere
T: Into<RequestQuerys>,
pub async fn set_request_header<K, V>(&self, key: K, value: V) -> &Self
pub async fn set_request_headers(&self, headers: RequestHeaders) -> &Self
pub async fn set_request_body<T: Into<RequestBody>>(&self, body: T) -> &Self
pub async fn get_response_headers(&self) -> ResponseHeaders
pub async fn get_response_header<K>(&self, key: K) -> OptionResponseHeadersValuewhere
K: Into<ResponseHeadersKey>,
pub async fn get_response_body(&self) -> ResponseBody
pub async fn get_response_body_string(&self) -> String
pub async fn get_response_body_json<T>(&self) -> ResultSerdeJsonError<T>where
T: DeserializeOwned,
pub async fn get_response_reason_phrase(&self) -> ResponseReasonPhrase
pub async fn get_response_status_code(&self) -> ResponseStatusCode
pub async fn set_response(&self, response: Response) -> &Self
pub async fn set_response_header<K, V>(&self, key: K, value: V) -> &Self
pub async fn set_response_headers(&self, headers: ResponseHeaders) -> &Self
pub async fn set_response_body<T: Into<ResponseBody>>(&self, body: T) -> &Self
pub async fn set_response_reason_phrase<T: Into<ResponseReasonPhrase>>( &self, reason_phrase: T, ) -> &Self
pub async fn set_response_status_code( &self, status_code: ResponseStatusCode, ) -> &Self
pub async fn is_enable_keep_alive(&self) -> bool
pub async fn is_disable_keep_alive(&self) -> bool
pub async fn is_enable_websocket(&self) -> bool
pub async fn is_disable_websocket(&self) -> bool
pub async fn handle_websocket(&self) -> ResponseResult
pub fn format_host_port(host: &str, port: &usize) -> String
pub async fn set_attribute<T: AnySendSyncClone>( &self, key: &str, value: &T, ) -> &Self
pub async fn get_attribute<T: AnySendSyncClone>(&self, key: &str) -> Option<T>
pub async fn remove_attribute(&self, key: &str) -> &Self
pub async fn clear_attribute(&self) -> &Self
pub async fn get_aborted(&self) -> bool
pub async fn set_aborted(&self, aborted: bool) -> &Self
pub async fn aborted(&self) -> &Self
pub async fn cancel_aborted(&self) -> &Self
pub async fn http_request_from_stream( &self, buffer_size: usize, ) -> RequestReaderHandleResult
pub async fn websocket_request_from_stream( &self, buffer_size: usize, ) -> RequestReaderHandleResult
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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