Paste code from image until it builds

This commit is contained in:
R.Chavignat committed 2018-03-13 00:06:56 +01:00
1 parent a92205909a
commit 8210a81672
4 files changed
+146 -142

No files matched your search

+6 -5
View File
@@ -4,6 +4,7 @@ use std::io::{self, Read, Seek};
use std::collections::{HashMap};
use super::stream::{ByteOrder, SmartReader, EndianReader};
use super::{ImageError, ImageResult};
use self::Value::{Unsigned, List};
@@ -95,15 +96,15 @@ pub enum Value {
}
impl Value {
pub fn into_u32(self) -> ::image::ImageResult<u32> {
pub fn into_u32(self) -> ImageResult<u32> {
match self {
Unsigned(val) => Ok(val),
val => Err(::image::ImageError::FormatError(format!(
val => Err(ImageError::FormatError(format!(
"Expected unsigned integer, {:?} found.", val
)))
}
}
pub fn into_u32_vec(self) -> ::image::ImageResult<Vec<u32>> {
pub fn into_u32_vec(self) -> ImageResult<Vec<u32>> {
match self {
List(vec) => {
let mut new_vec = Vec::with_capacity(vec.len());
@@ -152,7 +153,7 @@ impl Entry {
}
pub fn val<R: Read + Seek>(&self, decoder: &mut super::TIFFDecoder<R>)
-> ::image::ImageResult<Value> {
-> ImageResult<Value> {
let bo = decoder.byte_order();
match (self.type_, self.count) {
// TODO check if this could give wrong results
@@ -183,7 +184,7 @@ impl Entry {
}
Ok(List(v))
}
_ => Err(::image::ImageError::UnsupportedError("Unsupported data type.".to_string()))
_ => Err(ImageError::UnsupportedError("Unsupported data type.".to_string()))
}
}
}