You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Splitting up the callback into a client & server variant makes sense as most users of this crate are either or, not both. This would also allow a better typing of the Callbacks as e.g. client callbacks don't need to implement validate, while server callbacks have to.
This would also allow a protocol implementation to require Callbacks with a given specialization. A server callback could thus statically type the additional data provided by SessionData and the type required for validate:
pubtraitSpecialization{/// Additional data provided by the protocol implementation in callbacks.typeSessionData;/// Validation type returned on successful authenticationtypeValidation;/// Error type returned specifically on failed authentication, can indicate type of failure.typeValidationError;}impl<S:Specialization>SessionData<S>{[...]fnprotocol_session_data(&self) -> &S::SessionData{ ...}[...]}
pub traitServerCallback<Specialization> {fncallback(&self,session_data:&SessionData<Specialization::SessionData>,context:&Context,request:&mutRequest) -> Result<(),SessionError>;fnvalidate(&self,session_data:&SessionData<Specialization>,context:&Context) -> Result<Specialization::Validation,ValidationError<Specialization::ValidationError>>;}
The text was updated successfully, but these errors were encountered:
Splitting up the callback into a client & server variant makes sense as most users of this crate are either or, not both. This would also allow a better typing of the Callbacks as e.g. client callbacks don't need to implement
validate
, while server callbacks have to.This would also allow a protocol implementation to require Callbacks with a given specialization. A server callback could thus statically type the additional data provided by
SessionData
and the type required forvalidate
:The text was updated successfully, but these errors were encountered: