1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2024-05-19 16:58:04 +00:00

Derive Default trait for DataType (#100)

This commit is contained in:
Linus Unnebäck 2023-06-19 05:38:41 +02:00 committed by GitHub
parent a3508fe1c9
commit 55875d72de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -657,20 +657,15 @@ pub fn creation_time(creation_time: u64) -> u64 {
} }
} }
#[derive(Debug, Clone, PartialEq, Eq, Serialize)] #[derive(Debug, Default, Clone, PartialEq, Eq, Serialize)]
pub enum DataType { pub enum DataType {
#[default]
Binary = 0x000000, Binary = 0x000000,
Text = 0x000001, Text = 0x000001,
Image = 0x00000D, Image = 0x00000D,
TempoCpil = 0x000015, TempoCpil = 0x000015,
} }
impl std::default::Default for DataType {
fn default() -> Self {
DataType::Binary
}
}
impl TryFrom<u32> for DataType { impl TryFrom<u32> for DataType {
type Error = Error; type Error = Error;
fn try_from(value: u32) -> Result<DataType> { fn try_from(value: u32) -> Result<DataType> {