Qualify more paths in macro-generated code
This commit is contained in:
parent
f6371bb1f2
commit
e4ae2a40ee
@ -222,7 +222,7 @@ impl Request {
|
|||||||
|
|
||||||
const METADATA: #ruma_api::Metadata = self::METADATA;
|
const METADATA: #ruma_api::Metadata = self::METADATA;
|
||||||
|
|
||||||
fn try_from_http_request<T: #bytes::Buf>(
|
fn try_from_http_request<T: ::std::convert::AsRef<[::std::primitive::u8]>>(
|
||||||
request: #http::Request<T>
|
request: #http::Request<T>
|
||||||
) -> ::std::result::Result<Self, #ruma_api::error::FromHttpRequestError> {
|
) -> ::std::result::Result<Self, #ruma_api::error::FromHttpRequestError> {
|
||||||
if request.method() != #http::Method::#method {
|
if request.method() != #http::Method::#method {
|
||||||
@ -239,7 +239,7 @@ impl Request {
|
|||||||
#extract_body
|
#extract_body
|
||||||
#parse_body
|
#parse_body
|
||||||
|
|
||||||
Ok(Self {
|
::std::result::Result::Ok(Self {
|
||||||
#path_vars
|
#path_vars
|
||||||
#query_vars
|
#query_vars
|
||||||
#header_vars
|
#header_vars
|
||||||
|
@ -200,9 +200,9 @@ impl Request {
|
|||||||
fn try_into_http_request(
|
fn try_into_http_request(
|
||||||
self,
|
self,
|
||||||
base_url: &::std::primitive::str,
|
base_url: &::std::primitive::str,
|
||||||
access_token: ::std::option::Option<&str>,
|
access_token: ::std::option::Option<&::std::primitive::str>,
|
||||||
) -> ::std::result::Result<
|
) -> ::std::result::Result<
|
||||||
#http::Request<Vec<u8>>,
|
#http::Request<::std::vec::Vec<::std::primitive::u8>>,
|
||||||
#ruma_api::error::IntoHttpError,
|
#ruma_api::error::IntoHttpError,
|
||||||
> {
|
> {
|
||||||
let metadata = self::METADATA;
|
let metadata = self::METADATA;
|
||||||
|
@ -75,7 +75,7 @@ impl Response {
|
|||||||
fn try_into_http_response(
|
fn try_into_http_response(
|
||||||
self,
|
self,
|
||||||
) -> ::std::result::Result<
|
) -> ::std::result::Result<
|
||||||
#http::Response<::std::vec::Vec<u8>>,
|
#http::Response<::std::vec::Vec<::std::primitive::u8>>,
|
||||||
#ruma_api::error::IntoHttpError,
|
#ruma_api::error::IntoHttpError,
|
||||||
> {
|
> {
|
||||||
let mut resp_builder = #http::Response::builder()
|
let mut resp_builder = #http::Response::builder()
|
||||||
@ -88,7 +88,7 @@ impl Response {
|
|||||||
|
|
||||||
// This cannot fail because we parse each header value checking for errors as
|
// This cannot fail because we parse each header value checking for errors as
|
||||||
// each value is inserted and we only allow keys from the `http::header` module.
|
// each value is inserted and we only allow keys from the `http::header` module.
|
||||||
Ok(resp_builder.body(#body).unwrap())
|
::std::result::Result::Ok(resp_builder.body(#body).unwrap())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,19 +408,20 @@ fn expand_content_enum(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn from_parts(
|
fn from_parts(
|
||||||
event_type: &str, input: Box<#serde_json::value::RawValue>,
|
event_type: &::std::primitive::str,
|
||||||
) -> Result<Self, #serde_json::Error> {
|
input: ::std::boxed::Box<#serde_json::value::RawValue>,
|
||||||
|
) -> ::std::result::Result<Self, #serde_json::Error> {
|
||||||
match event_type {
|
match event_type {
|
||||||
#(
|
#(
|
||||||
#variant_attrs #event_type_str => {
|
#variant_attrs #event_type_str => {
|
||||||
let content = #content::from_parts(event_type, input)?;
|
let content = #content::from_parts(event_type, input)?;
|
||||||
Ok(#variant_ctors(content))
|
::std::result::Result::Ok(#variant_ctors(content))
|
||||||
},
|
},
|
||||||
)*
|
)*
|
||||||
ev_type => {
|
ev_type => {
|
||||||
let content =
|
let content =
|
||||||
#ruma_events::custom::CustomEventContent::from_parts(ev_type, input)?;
|
#ruma_events::custom::CustomEventContent::from_parts(ev_type, input)?;
|
||||||
Ok(Self::Custom(content))
|
::std::result::Result::Ok(Self::Custom(content))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -713,7 +714,7 @@ fn accessor_methods(
|
|||||||
|
|
||||||
let event_type = quote! {
|
let event_type = quote! {
|
||||||
/// Returns the `type` of this event.
|
/// Returns the `type` of this event.
|
||||||
pub fn event_type(&self) -> &str {
|
pub fn event_type(&self) -> &::std::primitive::str {
|
||||||
match self {
|
match self {
|
||||||
#( #self_variants(event) =>
|
#( #self_variants(event) =>
|
||||||
#ruma_events::EventContent::event_type(&event.content), )*
|
#ruma_events::EventContent::event_type(&event.content), )*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user