Trait SgRequestExt

Source
pub trait SgRequestExt {
    // Required methods
    fn with_reflect(&mut self);
    fn reflect_mut(&mut self) -> &mut Reflect;
    fn reflect(&self) -> &Reflect;
    fn get_redis_client_by_gateway_name(&self) -> Option<RedisClient>;
    fn extract<M>(&self) -> M
       where M: Extract;
    fn try_extract<M>(&self) -> Option<M>
       where M: OptionalExtract;
    fn inject<I>(&mut self, i: &I) -> Result<(), Box<dyn Error + Send + Sync>>
       where I: Inject;
    fn defer_call<F>(&mut self, f: F)
       where F: FnOnce(Request<SgBody>) -> Request<SgBody> + Send + 'static;
    fn path_iter(&self) -> PathIter<'_>;
    fn query_kv_iter(&self) -> Option<QueryKvIter<'_>>;
}
Expand description

Provides extension methods for Request.

Required Methods§

Source

fn with_reflect(&mut self)

Source

fn reflect_mut(&mut self) -> &mut Reflect

Source

fn reflect(&self) -> &Reflect

Source

fn get_redis_client_by_gateway_name(&self) -> Option<RedisClient>

Source

fn extract<M>(&self) -> M
where M: Extract,

Source

fn try_extract<M>(&self) -> Option<M>
where M: OptionalExtract,

Source

fn inject<I>(&mut self, i: &I) -> Result<(), Box<dyn Error + Send + Sync>>
where I: Inject,

§Errors

If the injection fails.

Source

fn defer_call<F>(&mut self, f: F)
where F: FnOnce(Request<SgBody>) -> Request<SgBody> + Send + 'static,

Source

fn path_iter(&self) -> PathIter<'_>

Source

fn query_kv_iter(&self) -> Option<QueryKvIter<'_>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SgRequestExt for Request<SgBody>

Source§

fn reflect_mut(&mut self) -> &mut Reflect

Get a mutable reference to the reflect extension.

§Panics

Panics if the reflect extension is not found. If you are using a request created by spacegate, this should never happen.

Source§

fn reflect(&self) -> &Reflect

Get a reference to the reflect extension.

§Panics

Panics if the reflect extension is not found. If you are using a request created by spacegate, this should never happen.

Source§

fn with_reflect(&mut self)

Add a reflect extension to the request if it does not exist.

Source§

fn get_redis_client_by_gateway_name(&self) -> Option<RedisClient>

Get a redis client by the extension::GatewayName, which would exist once the request had entered some gateway.

Source§

fn extract<M>(&self) -> M
where M: Extract,

Extract a value from the request.

Source§

fn try_extract<M>(&self) -> Option<M>
where M: OptionalExtract,

Try to extract a value from the request.

Source§

fn inject<I>(&mut self, i: &I) -> Result<(), Box<dyn Error + Send + Sync>>
where I: Inject,

Inject some data into the request.

Source§

fn defer_call<F>(&mut self, f: F)
where F: FnOnce(Request<SgBody>) -> Request<SgBody> + Send + 'static,

Defer a call to the request. The call will be executed before the request has been sent to the backend.

Source§

fn path_iter(&self) -> PathIter<'_>

Source§

fn query_kv_iter(&self) -> Option<QueryKvIter<'_>>

Implementors§