pub struct SgCtxResponse {
    pub status_code: MaybeModified<StatusCode>,
    pub headers: MaybeModified<HeaderMap<HeaderValue>>,
    pub body: Body,
    /* private fields */
}

Fields§

§status_code: MaybeModified<StatusCode>§headers: MaybeModified<HeaderMap<HeaderValue>>§body: Body

Implementations§

source§

impl SgCtxResponse

source

pub fn new() -> Self

source

pub fn is_resp_error(&self) -> bool

source

pub fn get_status_code(&self) -> &StatusCode

source

pub fn set_status_code(&mut self, status_code: StatusCode)

source

pub fn get_status_code_raw(&self) -> &StatusCode

source

pub fn get_headers(&self) -> &HeaderMap<HeaderValue>

source

pub fn get_headers_raw(&self) -> &HeaderMap<HeaderValue>

source

pub fn get_headers_mut(&mut self) -> &mut HeaderMap<HeaderValue>

source

pub fn set_headers(&mut self, req_headers: HeaderMap<HeaderValue>)

source

pub fn set_header_str(&mut self, key: &str, value: &str) -> TardisResult<()>

source

pub fn set_header(&mut self, key: HeaderName, value: &str) -> TardisResult<()>

source

pub fn remove_header(&mut self, key: HeaderName) -> TardisResult<()>

source

pub fn remove_header_str(&mut self, key: &str) -> TardisResult<()>

source

pub fn take_body(&mut self) -> Body

source

pub fn replace_body(&mut self, body: impl Into<Body>) -> Body

source

pub fn set_body(&mut self, body: impl Into<Body>)

source

pub async fn take_body_into_bytes(&mut self) -> TardisResult<Bytes>

it’s a shortcut for take_body + hyper::body::to_bytes

source

pub async fn take_body_into_buf(&mut self) -> TardisResult<impl Buf>

it’s a shortcut for take_body + hyper::body::aggregate

source

pub async fn dump_body(&mut self) -> TardisResult<Bytes>

Performance

This method will read all of the body and clone it, and it’s body will become an once stream which holds the whole body.

Trait Implementations§

source§

impl Debug for SgCtxResponse

source§

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

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

impl Default for SgCtxResponse

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more