Struct Request

Source
pub struct Request<'a, Rp, ReqDto, RespDto>
where Rp: RoutableProtocol + Send + Sync + Debug + 'static, ReqDto: 'static, RespDto: 'static,
{ /* private fields */ }

Implementations§

Source§

impl<'a, Rp, ReqDto, RespDto> Request<'a, Rp, ReqDto, RespDto>
where Rp: RoutableProtocol + Send + Sync + Debug + 'static,

Source

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

Source

pub async fn dto(&mut self) -> DceResult<ReqDto>

Source

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

Source

pub fn success( self, data: Option<RespDto>, ) -> DceResult<Option<Response<Rp::Resp>>>

Source

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

Source

pub fn resp<Resp: Into<RespDto>>( self, resp: Resp, ) -> DceResult<Option<Response<Rp::Resp>>>

Source

pub fn end(self, resp: Option<RespDto>) -> DceResult<Option<Response<Rp::Resp>>>

Source

pub fn pack( self, serialized: Serialized, ) -> DceResult<Option<Response<Rp::Resp>>>

Source

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

Source

pub fn new( api: &'static Api<Rp, ReqDto, RespDto>, context: &'a mut Context<Rp>, ) -> Request<'a, Rp, ReqDto, RespDto>

Methods from Deref<Target = Context<Rp>>§

Source

pub fn router(&self) -> &Arc<Router<Rp>>

Source

pub fn api(&self) -> Option<&'static (dyn ApiTrait<Rp> + Send + Sync)>

Source

pub fn rp(&self) -> &Rp

Source

pub fn rp_mut(&mut self) -> &mut Rp

Source

pub fn take_rp(&mut self) -> Option<Rp>

Source

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

Source

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

Source

pub fn suffix(&mut self) -> &'static str

Source

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

Source

pub fn put_data(&mut self, key: String, value: Box<dyn Any + Send>)

Source

pub fn get_as<S: 'static>(&self, key: &str) -> DceResult<&S>

Source

pub fn get_as_mut<S: 'static>(&mut self, key: &str) -> DceResult<&mut S>

Source

pub fn set_routed_info( &mut self, api: &'static (dyn ApiTrait<Rp> + Send + Sync), params: HashMap<&'static str, PathParam>, suffix: Option<&'static str>, )

Trait Implementations§

Source§

impl<'a, Rp, ReqDto, RespDto> Debug for Request<'a, Rp, ReqDto, RespDto>
where Rp: RoutableProtocol + Send + Sync + Debug + 'static + Debug, ReqDto: 'static + Debug, RespDto: 'static + Debug,

Source§

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

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

impl<Rp, ReqDto, RespDto> Deref for Request<'_, Rp, ReqDto, RespDto>
where Rp: RoutableProtocol + Send + Sync + Debug + 'static,

Source§

type Target = Context<Rp>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<Rp, ReqDto, RespDto> DerefMut for Request<'_, Rp, ReqDto, RespDto>
where Rp: RoutableProtocol + Send + Sync + Debug + 'static,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<Rp, ReqDto, RespDto> RequestTrait for Request<'_, Rp, ReqDto, RespDto>
where Rp: RoutableProtocol + Send + Sync + Debug + 'static,

Source§

type Rp = Rp

Source§

type ReqDto = ReqDto

Source§

type RespDto = RespDto

Auto Trait Implementations§

§

impl<'a, Rp, ReqDto, RespDto> Freeze for Request<'a, Rp, ReqDto, RespDto>

§

impl<'a, Rp, ReqDto, RespDto> !RefUnwindSafe for Request<'a, Rp, ReqDto, RespDto>

§

impl<'a, Rp, ReqDto, RespDto> Send for Request<'a, Rp, ReqDto, RespDto>

§

impl<'a, Rp, ReqDto, RespDto> !Sync for Request<'a, Rp, ReqDto, RespDto>

§

impl<'a, Rp, ReqDto, RespDto> Unpin for Request<'a, Rp, ReqDto, RespDto>

§

impl<'a, Rp, ReqDto, RespDto> !UnwindSafe for Request<'a, Rp, ReqDto, 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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>,

Source§

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.