pub struct HttpUpgrade { /* private fields */ }Expand description
A validated HTTP protocol switch plus its post-handshake session handler.
Implementations§
Source§impl HttpUpgrade
impl HttpUpgrade
pub fn new( protocol: &'static str, headers: Vec<ResponseHeader>, handler: impl FnOnce(Box<dyn UpgradedIo>) -> UpgradeFuture + 'static, ) -> Self
pub const fn protocol(&self) -> &'static str
pub fn headers(&self) -> &[ResponseHeader]
pub fn extend_headers( &mut self, headers: impl IntoIterator<Item = ResponseHeader>, )
Sourcepub async fn run(self, io: Box<dyn UpgradedIo>) -> Result<(), UpgradeIoError>
pub async fn run(self, io: Box<dyn UpgradedIo>) -> Result<(), UpgradeIoError>
Runs the one-shot upgraded protocol session.
§Errors
Returns the adapter or upgraded protocol error produced by the session.
Trait Implementations§
Source§impl ApiSchema for HttpUpgrade
impl ApiSchema for HttpUpgrade
fn type_descriptor() -> TypeDescriptor
Source§fn validate_input(&self) -> Result<(), ValidationErrors>
fn validate_input(&self) -> Result<(), ValidationErrors>
Validates a decoded operation argument. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for HttpUpgrade
impl !Send for HttpUpgrade
impl !Sync for HttpUpgrade
impl !UnwindSafe for HttpUpgrade
impl Freeze for HttpUpgrade
impl Unpin for HttpUpgrade
impl UnsafeUnpin for HttpUpgrade
Blanket Implementations§
Source§impl<T> BackgroundExt for T
impl<T> BackgroundExt for T
fn background(self, task: BackgroundTask) -> Background<Self>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more