Use more descriptive names for properties with one-character-names in the spec

This commit is contained in:
Jonas Platte 2017-08-04 10:35:56 +02:00
parent b852b15134
commit b741ec3028
3 changed files with 10 additions and 6 deletions

View File

@ -221,8 +221,9 @@ pub struct VideoInfo {
#[serde(skip_serializing_if="Option::is_none")] #[serde(skip_serializing_if="Option::is_none")]
pub duration: Option<u64>, pub duration: Option<u64>,
/// The height of the video in pixels. /// The height of the video in pixels.
#[serde(rename = "h")]
#[serde(skip_serializing_if="Option::is_none")] #[serde(skip_serializing_if="Option::is_none")]
pub h: Option<u64>, pub height: Option<u64>,
/// The mimetype of the video, e.g. "video/mp4." /// The mimetype of the video, e.g. "video/mp4."
#[serde(skip_serializing_if="Option::is_none")] #[serde(skip_serializing_if="Option::is_none")]
pub mimetype: Option<String>, pub mimetype: Option<String>,
@ -236,8 +237,9 @@ pub struct VideoInfo {
#[serde(skip_serializing_if="Option::is_none")] #[serde(skip_serializing_if="Option::is_none")]
pub thumbnail_url: Option<String>, pub thumbnail_url: Option<String>,
/// The width of the video in pixels. /// The width of the video in pixels.
#[serde(rename = "w")]
#[serde(skip_serializing_if="Option::is_none")] #[serde(skip_serializing_if="Option::is_none")]
pub w: Option<u64>, pub width: Option<u64>,
} }
impl_enum! { impl_enum! {

View File

@ -21,11 +21,13 @@ pub mod topic;
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct ImageInfo { pub struct ImageInfo {
/// The height of the image in pixels. /// The height of the image in pixels.
pub h: u64, #[serde(rename = "h")]
pub height: u64,
/// The MIME type of the image, e.g. "image/png." /// The MIME type of the image, e.g. "image/png."
pub mimetype: String, pub mimetype: String,
/// The file size of the image in bytes. /// The file size of the image in bytes.
pub size: u64, pub size: u64,
/// The width of the image in pixels. /// The width of the image in pixels.
pub w: u64, #[serde(rename = "w")]
pub width: u64,
} }

View File

@ -333,8 +333,8 @@ mod tests {
StrippedState::RoomAvatar(event) => { StrippedState::RoomAvatar(event) => {
let image_info = event.content.info.unwrap(); let image_info = event.content.info.unwrap();
assert_eq!(image_info.h, 128); assert_eq!(image_info.height, 128);
assert_eq!(image_info.w, 128); assert_eq!(image_info.width, 128);
assert_eq!(image_info.mimetype, "image/jpeg"); assert_eq!(image_info.mimetype, "image/jpeg");
assert_eq!(image_info.size, 1024); assert_eq!(image_info.size, 1024);
assert_eq!(event.content.thumbnail_info.unwrap().size, 32); assert_eq!(event.content.thumbnail_info.unwrap().size, 32);