Struct dce_router::request::Request

source ·
pub struct Request<Raw, ReqDto, Req, Resp, RespDto>
where Raw: RawRequest + Debug + 'static, ReqDto: 'static, Req: From<ReqDto> + 'static, Resp: Into<RespDto> + 'static, RespDto: 'static,
{ /* private fields */ }

Implementations§

source§

impl<Raw, ReqDto, Req, Resp, RespDto> Request<Raw, ReqDto, Req, Resp, RespDto>
where Raw: RawRequest + Debug + 'static, ReqDto: 'static, Req: From<ReqDto> + 'static, Resp: Into<RespDto> + 'static, RespDto: 'static,

source

pub fn api(&self) -> &Api<Raw, ReqDto, Req, Resp, RespDto>

source

pub fn params(&self) -> &HashMap<&'static str, PathParam>

source

pub fn param(&self, key: &str) -> DceResult<&PathParam>

source

pub fn context(&self) -> &HashMap<String, Box<dyn Any + Send>>

source

pub fn raw(&self) -> &Raw

source

pub fn rpi(&self) -> &Raw::Rpi

source

pub fn rpi_mut(&mut self) -> &mut Raw::Rpi

source

pub async fn req(&mut self) -> DceResult<Req>

source

pub fn status( self, status: bool, data: Option<Resp>, message: Option<String>, code: isize ) -> DceResult<Option<Raw::Resp>>

source

pub fn success(self, data: Option<Resp>) -> DceResult<Option<Raw::Resp>>

source

pub fn fail( self, message: Option<String>, code: isize ) -> DceResult<Option<Raw::Resp>>

source

pub fn resp(self, resp: Resp) -> DceResult<Option<Raw::Resp>>

source

pub fn end(self, resp: Option<Resp>) -> DceResult<Option<Raw::Resp>>

source

pub fn pack_resp(self, resp: Serialized) -> DceResult<Option<Raw::Resp>>

source

pub fn raw_resp(self, resp: Raw::Resp) -> DceResult<Option<Raw::Resp>>

source

pub fn parse_api_method_and_extras( prop_tuples: Vec<(&'static str, Box<dyn Any + Send + Sync>)> ) -> (Option<Box<dyn Method<Raw::Rpi> + Send + Sync>>, HashMap<&'static str, Box<dyn Any + Send + Sync>>)

source

pub fn new( api: &'static Api<Raw, ReqDto, Req, Resp, RespDto>, context: RequestContext<Raw> ) -> Request<Raw, ReqDto, Req, Resp, RespDto>

Trait Implementations§

source§

impl<Raw, ReqDto, Req, Resp, RespDto> Debug for Request<Raw, ReqDto, Req, Resp, RespDto>
where Raw: RawRequest + Debug + 'static + Debug, ReqDto: 'static + Debug, Req: From<ReqDto> + 'static + Debug, Resp: Into<RespDto> + 'static + Debug, RespDto: 'static + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Raw, ReqDto, Req, Resp, RespDto> RequestTrait for Request<Raw, ReqDto, Req, Resp, RespDto>
where Raw: RawRequest + Debug + 'static, ReqDto: 'static, Req: From<ReqDto> + 'static, Resp: Into<RespDto> + 'static, RespDto: 'static,

§

type Raw = Raw

Auto Trait Implementations§

§

impl<Raw, ReqDto, Req, Resp, RespDto> !RefUnwindSafe for Request<Raw, ReqDto, Req, Resp, RespDto>

§

impl<Raw, ReqDto, Req, Resp, RespDto> Send for Request<Raw, ReqDto, Req, Resp, RespDto>
where Raw: Send, Req: Sync, Resp: Sync,

§

impl<Raw, ReqDto, Req, Resp, RespDto> !Sync for Request<Raw, ReqDto, Req, Resp, RespDto>

§

impl<Raw, ReqDto, Req, Resp, RespDto> Unpin for Request<Raw, ReqDto, Req, Resp, RespDto>
where Raw: Unpin,

§

impl<Raw, ReqDto, Req, Resp, RespDto> !UnwindSafe for Request<Raw, ReqDto, Req, Resp, RespDto>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.