vim server_architektur.rs ; add methods to DataStore
This commit is contained in:
		@ -80,6 +80,13 @@ pub mod persistency {
 | 
			
		||||
    use std::io;
 | 
			
		||||
    use std::path::{Path, PathBuf};
 | 
			
		||||
    use std::sync::Arc;
 | 
			
		||||
    
 | 
			
		||||
    pub type TextureFileResult = Result< Arc<Vec<u8>> , TextureFileError>
 | 
			
		||||
    pub enum TextureFileError {
 | 
			
		||||
        NotFound,
 | 
			
		||||
        IOError(io::Error),
 | 
			
		||||
        ImgError(::image::Error),
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub struct DataStore {
 | 
			
		||||
        // private attributes
 | 
			
		||||
@ -98,14 +105,41 @@ pub mod persistency {
 | 
			
		||||
            unimplemented!()
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // TODO: think
 | 
			
		||||
 | 
			
		||||
        pub fn search(&mut self, query: &self::search::Query) -> Vec<Texture> {
 | 
			
		||||
        pub fn query(&mut self, query: &self::search::Query) -> Vec<Texture> {
 | 
			
		||||
            unimplemented!();
 | 
			
		||||
            // calls self::search::search(... )
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        /// returns true if successful
 | 
			
		||||
        pub fn delete(&mut self, tex: &Texture) -> bool {
 | 
			
		||||
            unimplemented!();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        pub fn insert(&mut self, tex: Texture) -> bool {
 | 
			
		||||
            unimplemented!();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        pub fn by_name<'a>(&'a self, name: &str) -> &'a Texture {
 | 
			
		||||
            unimplemented!();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        pub fn by_id<'a, 'b>(&'a self, id: &'b str) -> &'a Texture {
 | 
			
		||||
            unimplemented!();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        pub fn has_hash(&self, hash: &Sha256) -> bool {
 | 
			
		||||
            unimplemented!();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        pub fn get_texture_file(&mut self, hash: &Sha256) -> TextureFileResult {
 | 
			
		||||
            unimplemented!();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        pub fn get_texture_preview(&mut self, hash: &Sha256) -> TextureFileResult {
 | 
			
		||||
            unimplemented!();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    pub use self::search::Query;
 | 
			
		||||
 | 
			
		||||
    mod search {
 | 
			
		||||
@ -146,23 +180,21 @@ pub mod persistency {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
    pub mod image_convert {
 | 
			
		||||
        use crate::model::*;
 | 
			
		||||
 | 
			
		||||
pub mod image_convert {
 | 
			
		||||
    use crate::model::*;
 | 
			
		||||
        pub struct ConvertConfig {
 | 
			
		||||
            pub desired_size: (usize, usize),
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    pub struct ConvertConfig {
 | 
			
		||||
        pub desired_size: (usize, usize),
 | 
			
		||||
        pub fn generate_preview(
 | 
			
		||||
            input: &[u8],
 | 
			
		||||
            format: TextureFormat,
 | 
			
		||||
            config: &ConvertConfig,
 | 
			
		||||
        ) -> ::image::ImageResult<Vec<u8>> {
 | 
			
		||||
            unimplemented!()
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn generate_preview(
 | 
			
		||||
        input: &[u8],
 | 
			
		||||
        format: TextureFormat,
 | 
			
		||||
        config: &ConvertConfig,
 | 
			
		||||
    ) -> ::image::ImageResult<Vec<u8>> {
 | 
			
		||||
        unimplemented!()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub mod main {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user