pub struct RequestorHelper;
Implementations§
Source§impl RequestorHelper
impl RequestorHelper
pub fn new_response(code: StatusCode) -> Response
pub fn new_ok_response<R>() -> R
pub fn trans_error<R>(e: BuckyError) -> R
pub async fn error_from_resp(resp: &mut Response) -> BuckyError
pub fn insert_device_list_header( http_req: &mut Request, device_list: &Vec<DeviceId>, )
pub fn insert_headers<T>(http_req: &mut Request, name: &str, list: &Vec<T>)where
T: ToString,
pub fn insert_headers_with_encoding<T>(
http_req: &mut Request,
name: &str,
list: &Vec<T>,
)where
T: ToString,
pub fn trans_status_code(code: StatusCode) -> BuckyErrorCode
pub fn decode_optional_hex_header<R>(
req: &R,
name: &str,
) -> BuckyResult<Option<Vec<u8>>>where
R: HeaderOp,
pub fn decode_optional_header<T, R>( req: &R, name: impl Into<HeaderName>, ) -> BuckyResult<Option<T>>
pub fn decode_utf8<'a>( name: &'a str, value: &'a str, ) -> BuckyResult<Cow<'a, str>>
pub fn decode_optional_header_with_utf8_decoding<T, R>( req: &R, name: impl Into<HeaderName>, ) -> BuckyResult<Option<T>>
pub fn decode_header<T, R>( req: &R, name: impl Into<HeaderName>, ) -> BuckyResult<T>
pub fn decode_header_with_utf8_decoding<T, R>( req: &R, name: impl Into<HeaderName>, ) -> BuckyResult<T>
pub fn decode_optional_headers<T, R>( req: &R, name: impl Into<HeaderName>, ) -> BuckyResult<Option<Vec<T>>>
pub fn decode_headers<T, R>( req: &R, name: impl Into<HeaderName>, ) -> BuckyResult<Vec<T>>
pub fn decode_optional_headers_with_utf8_decoding<T, R>( req: &R, name: impl Into<HeaderName>, ) -> BuckyResult<Option<Vec<T>>>
pub fn decode_headers_with_utf8_decoding<T, R>( req: &R, name: impl Into<HeaderName>, ) -> BuckyResult<Vec<T>>
pub fn decode_json_header<T, R>( req: &R, name: impl Into<HeaderName>, ) -> BuckyResult<T>
pub fn decode_optional_json_header<T, R>( req: &R, name: impl Into<HeaderName>, ) -> BuckyResult<Option<T>>
pub fn decode_optional_json_headers<T, R>( req: &R, name: impl Into<HeaderName>, ) -> BuckyResult<Option<Vec<T>>>
pub async fn decode_raw_data_body<R>(body: &mut R) -> BuckyResult<Vec<u8>>where
R: BodyOp,
pub async fn decode_raw_object_body<R, T>(body: &mut R) -> BuckyResult<T>
pub async fn decode_str_body<R, T>(body: &mut R) -> BuckyResult<T>
pub async fn decode_json_body<R, T>(resp: &mut R) -> BuckyResult<T>
pub async fn decode_serde_json_body<R, T>(resp: &mut R) -> BuckyResult<T>where
R: BodyOp,
T: for<'de> Deserialize<'de>,
pub fn decode_url_param<T>(k: Cow<'_, str>, v: Cow<'_, str>) -> BuckyResult<T>
pub fn decode_url_param_with_utf8_decoding<T>( k: Cow<'_, str>, v: Cow<'_, str>, ) -> BuckyResult<T>
pub fn decode_url_param_list<T>( k: Cow<'_, str>, v: Cow<'_, str>, ) -> BuckyResult<Vec<T>>
pub fn encode_opt_header<T, R>(req: &mut R, name: &str, value: &Option<T>)
pub fn encode_opt_header_with_encoding<R>(
req: &mut R,
name: &str,
value: Option<&str>,
)where
R: HeaderOp,
pub fn encode_header<T, R>(req: &mut R, name: &str, value: &T)
pub fn encode_header_with_encoding<R>(req: &mut R, name: &str, value: &str)where
R: HeaderOp,
pub fn encode_time_header<R>(
req: &mut R,
name: impl Into<HeaderName>,
bucky_time: u64,
)where
R: HeaderOp,
pub async fn request_to_service( service_addr: &SocketAddr, req: Request, ) -> BuckyResult<Response>
pub fn value_from_querys<T>(name: &str, url: &Url) -> BuckyResult<Option<T>>
pub fn value_from_querys_with_utf8_decoding<T>( name: &str, url: &Url, ) -> BuckyResult<Option<T>>
pub fn dec_id_from_request(req: &Request) -> BuckyResult<Option<ObjectId>>
Auto Trait Implementations§
impl Freeze for RequestorHelper
impl RefUnwindSafe for RequestorHelper
impl Send for RequestorHelper
impl Sync for RequestorHelper
impl Unpin for RequestorHelper
impl UnwindSafe for RequestorHelper
Blanket Implementations§
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more