remove some allow annotions and fix resulting warnings
This commit is contained in:
parent
cd5e69145f
commit
66fc54cb3e
@ -1,8 +1,3 @@
|
|||||||
// TODO: remove on implementation
|
|
||||||
#![allow(unused_imports)]
|
|
||||||
#![allow(unused_variables)]
|
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
|
|
||||||
@ -18,7 +13,7 @@ pub mod persistency;
|
|||||||
pub mod protocol;
|
pub mod protocol;
|
||||||
|
|
||||||
mod server_state;
|
mod server_state;
|
||||||
use server_state::*;
|
//use server_state::*;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
lovecraft::invoke();
|
lovecraft::invoke();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use serde::{Deserializer, Serialize};
|
use serde::Serialize;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
mod sha256;
|
mod sha256;
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
#![allow(unused_variables)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, Eq, Hash, PartialEq)]
|
#[derive(Clone, Debug, Deserialize, Serialize, Eq, Hash, PartialEq)]
|
||||||
pub enum TextureFormat {
|
pub enum TextureFormat {
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
use crate::model::*;
|
use crate::model::*;
|
||||||
|
|
||||||
use std::collections::*;
|
use std::collections::*;
|
||||||
use std::fs;
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
pub use self::search::Query;
|
pub use self::search::Query;
|
||||||
mod image_convert;
|
mod image_convert;
|
||||||
@ -39,7 +37,7 @@ pub struct DataStore {
|
|||||||
id_index: HashMap<String, Texture>,
|
id_index: HashMap<String, Texture>,
|
||||||
name_index: HashMap<String, Texture>,
|
name_index: HashMap<String, Texture>,
|
||||||
|
|
||||||
preview_cache: HashMap<(TextureFormat, Sha256), Vec<u8>>,
|
_preview_cache: HashMap<(TextureFormat, Sha256), Vec<u8>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DataStore {
|
impl DataStore {
|
||||||
@ -69,7 +67,7 @@ impl DataStore {
|
|||||||
id_index: Default::default(),
|
id_index: Default::default(),
|
||||||
name_index: Default::default(),
|
name_index: Default::default(),
|
||||||
|
|
||||||
preview_cache: Default::default(),
|
_preview_cache: Default::default(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let metadata_file = metadata_file::MetadataFile::load(base_dir)?;
|
let metadata_file = metadata_file::MetadataFile::load(base_dir)?;
|
||||||
@ -173,8 +171,8 @@ impl DataStore {
|
|||||||
|
|
||||||
pub fn get_texture_preview(
|
pub fn get_texture_preview(
|
||||||
&mut self,
|
&mut self,
|
||||||
hash: &Sha256,
|
_hash: &Sha256,
|
||||||
desired_format: TextureFormat,
|
_desired_format: TextureFormat,
|
||||||
) -> TextureFileResult {
|
) -> TextureFileResult {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
@ -183,7 +181,7 @@ impl DataStore {
|
|||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn query(&mut self, query: &self::search::Query) -> Vec<Texture> {
|
pub fn query(&mut self, _query: &self::search::Query) -> Vec<Texture> {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
// calls self::search::search(... )
|
// calls self::search::search(... )
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#![allow(unused_variables)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use crate::model::*;
|
use crate::model::*;
|
||||||
|
|
||||||
pub struct Query {
|
pub struct Query {
|
||||||
|
@ -1 +0,0 @@
|
|||||||
use crate::model::*;
|
|
@ -3,7 +3,7 @@ use super::*;
|
|||||||
use std::io::*;
|
use std::io::*;
|
||||||
use std::net::*;
|
use std::net::*;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::Serialize;
|
||||||
|
|
||||||
pub struct Connection<R: Read + Sized, W: Write + Sized> {
|
pub struct Connection<R: Read + Sized, W: Write + Sized> {
|
||||||
reader: R,
|
reader: R,
|
||||||
@ -139,9 +139,9 @@ impl<R: Read + Sized, W: Write + Sized> Connection<R, W> {
|
|||||||
_ => (), // else try other
|
_ => (), // else try other
|
||||||
}
|
}
|
||||||
|
|
||||||
let json: Command = serde_json::from_slice(&payload[..]).map_err(|e| {
|
let json: Command = serde_json::from_slice(&payload[..]).map_err(|_e| {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
dbg!(&e);
|
dbg!(&_e);
|
||||||
|
|
||||||
Error::new(ErrorKind::InvalidData, "Invalid JSON.")
|
Error::new(ErrorKind::InvalidData, "Invalid JSON.")
|
||||||
})?;
|
})?;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use std::io::*;
|
|
||||||
use std::net::*;
|
use std::net::*;
|
||||||
|
|
||||||
use std::thread;
|
use std::thread;
|
||||||
@ -105,7 +104,7 @@ where
|
|||||||
Ok(ReplaceTextureStatus::Ok) => {
|
Ok(ReplaceTextureStatus::Ok) => {
|
||||||
connection.send(&Package::Json(JsonValue::True))?;
|
connection.send(&Package::Json(JsonValue::True))?;
|
||||||
}
|
}
|
||||||
Ok(ReplaceTextureStatus::NeedTextureData(hash)) => {
|
Ok(ReplaceTextureStatus::NeedTextureData(_hash)) => {
|
||||||
panic!("Contract Violation: handler must not return NeedTextureData \
|
panic!("Contract Violation: handler must not return NeedTextureData \
|
||||||
when data is given.");
|
when data is given.");
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,6 @@ pub enum Command {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
use super::error::*;
|
|
||||||
|
|
||||||
impl From<ProtocolError> for Package {
|
impl From<ProtocolError> for Package {
|
||||||
fn from(item: ProtocolError) -> Self {
|
fn from(item: ProtocolError) -> Self {
|
||||||
match item {
|
match item {
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
mod error;
|
|
||||||
pub use self::error::*;
|
|
||||||
|
|
||||||
mod implementation;
|
mod implementation;
|
||||||
pub use self::implementation::*;
|
pub use self::implementation::*;
|
||||||
|
|
||||||
use crate::model::*;
|
use crate::model::*;
|
||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
pub trait ProtocolHandler: Send + Sync + Clone {
|
pub trait ProtocolHandler: Send + Sync + Clone {
|
||||||
fn query(&mut self, query: &[String]) -> ProtocolResult<Vec<Texture>>;
|
fn query(&mut self, query: &[String]) -> ProtocolResult<Vec<Texture>>;
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
// TODO: remove on implementation
|
|
||||||
#![allow(unused_imports)]
|
|
||||||
#![allow(unused_variables)]
|
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
use crate::model::*;
|
use crate::model::*;
|
||||||
use crate::persistency::*;
|
use crate::persistency::*;
|
||||||
use crate::protocol::*;
|
use crate::protocol::*;
|
||||||
@ -16,6 +11,7 @@ pub struct ServerState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ServerState {
|
impl ServerState {
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn new(storage_path: &Path) -> std::io::Result<Self> {
|
pub fn new(storage_path: &Path) -> std::io::Result<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
data_store: Arc::new(RwLock::new(DataStore::new(&storage_path)?)),
|
data_store: Arc::new(RwLock::new(DataStore::new(&storage_path)?)),
|
||||||
@ -24,7 +20,7 @@ impl ServerState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ProtocolHandler for ServerState {
|
impl ProtocolHandler for ServerState {
|
||||||
fn query(&mut self, query: &[String]) -> ProtocolResult<Vec<Texture>> {
|
fn query(&mut self, _query: &[String]) -> ProtocolResult<Vec<Texture>> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user