diff options
Diffstat (limited to 'src/jpeg/segment.rs')
-rw-r--r-- | src/jpeg/segment.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/jpeg/segment.rs b/src/jpeg/segment.rs index cd1a651..c0512a1 100644 --- a/src/jpeg/segment.rs +++ b/src/jpeg/segment.rs @@ -2,7 +2,7 @@ use std::{mem::size_of, usize}; use img_parts::jpeg::{markers, Jpeg, JpegSegment}; -use crate::{codec::Codec, CodecError}; +use crate::{codec::Codec, Error}; /// Codec for storing payload data in JPEG comment (COM) segments. Can store an arbitrary amount of /// data, as long as the number of comment segments does not exceed u64::MAX. @@ -13,11 +13,11 @@ pub struct JpegSegmentCodec { } impl Codec for JpegSegmentCodec { - fn encode(&self, carrier: &[u8], payload: &[u8]) -> Result<Vec<u8>, CodecError> + fn encode(&self, carrier: &[u8], payload: &[u8]) -> Result<Vec<u8>, Error> { let mut jpeg = match Jpeg::from_bytes(carrier.to_vec().into()) { Ok(v) => v, - Err(e) => return Err(CodecError::DependencyError(e.to_string())) + Err(e) => return Err(Error::DependencyError(e.to_string())) }; let mut payload_bytes = payload.to_vec(); let segment_count = ((payload_bytes.len() + size_of::<u64>()) as u64).div_ceil((u16::MAX as usize - size_of::<u16>()) as u64); @@ -29,11 +29,11 @@ impl Codec for JpegSegmentCodec { Ok(jpeg.encoder().bytes().to_vec()) } - fn decode(&self, encoded: &[u8]) -> Result<(Vec<u8>, Vec<u8>), CodecError> + fn decode(&self, encoded: &[u8]) -> Result<(Vec<u8>, Vec<u8>), Error> { let mut jpeg = match Jpeg::from_bytes(encoded.to_vec().into()) { Ok(v) => v, - Err(e) => return Err(CodecError::DependencyError(e.to_string())) + Err(e) => return Err(Error::DependencyError(e.to_string())) }; let segment = jpeg.segments_mut().remove(self.start_index); let segment_bytes = segment.contents(); |