Use slices for outgoing raw bodies

This commit is contained in:
Jonas Platte 2021-05-10 15:16:37 +02:00
parent d16fbe6fe6
commit d71fa97346
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
3 changed files with 4 additions and 4 deletions

View File

@ -185,7 +185,7 @@ use ruma_identifiers::UserId;
///
/// request: {
/// #[ruma_api(raw_body)]
/// pub file: Vec<u8>,
/// pub file: &'a [u8],
/// }
///
/// response: {

View File

@ -111,7 +111,7 @@ pub mod newtype_raw_body_endpoint {
request: {
#[ruma_api(raw_body)]
pub file: Vec<u8>,
pub file: &'a [u8],
}
response: {

View File

@ -16,7 +16,7 @@ ruma_api! {
request: {
/// The file contents to upload.
#[ruma_api(raw_body)]
pub file: Vec<u8>,
pub file: &'a [u8],
/// The name of the file being uploaded.
#[ruma_api(query)]
@ -48,7 +48,7 @@ ruma_api! {
impl<'a> Request<'a> {
/// Creates a new `Request` with the given file contents.
pub fn new(file: Vec<u8>) -> Self {
pub fn new(file: &'a [u8]) -> Self {
Self { file, filename: None, content_type: None }
}
}