1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2025-01-07 02:35:26 +00:00

fix(mp4box): remove unwrap() in to_json() for Mp4Box implementation.

This commit is contained in:
Stuart Woodbury 2023-07-05 09:49:32 -04:00
parent 6a6e746c3f
commit 3e23adae7f
43 changed files with 48 additions and 48 deletions

View file

@ -68,7 +68,7 @@ impl Mp4Box for Avc1Box {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {
@ -200,7 +200,7 @@ impl Mp4Box for AvcCBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -34,7 +34,7 @@ impl Mp4Box for Co64Box {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -40,7 +40,7 @@ impl Mp4Box for CttsBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -37,7 +37,7 @@ impl Mp4Box for DataBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -28,7 +28,7 @@ impl Mp4Box for DinfBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {
@ -132,7 +132,7 @@ impl Mp4Box for DrefBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {
@ -249,7 +249,7 @@ impl Mp4Box for UrlBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -37,7 +37,7 @@ impl Mp4Box for EdtsBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -48,7 +48,7 @@ impl Mp4Box for ElstBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -49,7 +49,7 @@ impl Mp4Box for EmsgBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -31,7 +31,7 @@ impl Mp4Box for FtypBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -32,7 +32,7 @@ impl Mp4Box for HdlrBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -68,7 +68,7 @@ impl Mp4Box for Hev1Box {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {
@ -181,7 +181,7 @@ impl Mp4Box for HvcCBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -37,7 +37,7 @@ impl Mp4Box for IlstBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -58,7 +58,7 @@ impl Mp4Box for MdhdBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -31,7 +31,7 @@ impl Mp4Box for MdiaBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -38,7 +38,7 @@ impl Mp4Box for MehdBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -57,7 +57,7 @@ impl Mp4Box for MetaBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -41,7 +41,7 @@ impl Mp4Box for MfhdBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -45,7 +45,7 @@ impl Mp4Box for MinfBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -36,7 +36,7 @@ impl Mp4Box for MoofBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -52,7 +52,7 @@ impl Mp4Box for MoovBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -61,7 +61,7 @@ impl Mp4Box for Mp4aBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {
@ -170,7 +170,7 @@ impl Mp4Box for EsdsBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -30,7 +30,7 @@ impl Mp4Box for MvexBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -67,7 +67,7 @@ impl Mp4Box for MvhdBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -43,7 +43,7 @@ impl Mp4Box for SmhdBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -64,7 +64,7 @@ impl Mp4Box for StblBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -34,7 +34,7 @@ impl Mp4Box for StcoBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -42,7 +42,7 @@ impl Mp4Box for StscBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -59,7 +59,7 @@ impl Mp4Box for StsdBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -34,7 +34,7 @@ impl Mp4Box for StssBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -36,7 +36,7 @@ impl Mp4Box for StszBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -40,7 +40,7 @@ impl Mp4Box for SttsBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -37,7 +37,7 @@ impl Mp4Box for TfdtBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -58,7 +58,7 @@ impl Mp4Box for TfhdBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -126,7 +126,7 @@ impl Mp4Box for TkhdBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -36,7 +36,7 @@ impl Mp4Box for TrafBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -44,7 +44,7 @@ impl Mp4Box for TrakBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -35,7 +35,7 @@ impl Mp4Box for TrexBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -69,7 +69,7 @@ impl Mp4Box for TrunBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -62,7 +62,7 @@ impl Mp4Box for Tx3gBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -35,7 +35,7 @@ impl Mp4Box for UdtaBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -39,7 +39,7 @@ impl Mp4Box for VmhdBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -75,7 +75,7 @@ impl Mp4Box for Vp09Box {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {

View file

@ -32,7 +32,7 @@ impl Mp4Box for VpccBox {
}
fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
}
fn summary(&self) -> Result<String> {