Struct Context

Source
pub struct Context<Rp: RoutableProtocol + 'static> { /* private fields */ }

Implementations§

Source§

impl<Rp: RoutableProtocol + Debug + 'static> Context<Rp>

Source

pub fn new( router: Arc<Router<Rp>>, rp: Rp, data: HashMap<String, Box<dyn Any + Send>>, ) -> 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<Rp: Debug + RoutableProtocol + 'static> Debug for Context<Rp>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Rp> Freeze for Context<Rp>
where Rp: Freeze,

§

impl<Rp> !RefUnwindSafe for Context<Rp>

§

impl<Rp> Send for Context<Rp>
where Rp: Send,

§

impl<Rp> !Sync for Context<Rp>

§

impl<Rp> Unpin for Context<Rp>
where Rp: Unpin,

§

impl<Rp> !UnwindSafe for Context<Rp>

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

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.