darkwiki: Fix imports.

This commit is contained in:
Luther Blissett
2022-09-24 15:28:08 +02:00
parent d42d99c954
commit ac5576a63a
3 changed files with 12 additions and 14 deletions

View File

@@ -1,5 +1,4 @@
use async_trait::async_trait;
use log::error;
use serde_json::{json, Value};

View File

@@ -1,4 +1,3 @@
use async_std::sync::{Arc, Mutex};
use std::{
fs::{create_dir_all, read_dir, remove_dir_all, remove_file},
io::stdin,
@@ -6,6 +5,7 @@ use std::{
};
use async_executor::Executor;
use async_std::sync::{Arc, Mutex};
use crypto_box::{
aead::{Aead, AeadCore},
rand_core::OsRng,
@@ -27,12 +27,11 @@ use darkfi::{
net::{self, settings::SettingsOpt},
raft::{NetMsg, ProtocolRaft, Raft, RaftSettings},
rpc::server::listen_and_serve,
serial::{deserialize, serialize, SerialDecodable, SerialEncodable},
util::{
cli::{get_log_config, get_log_level, spawn_config},
expand_path,
file::{load_file, load_json_file, save_file, save_json_file},
path::get_config_path,
serial::{deserialize, serialize, SerialDecodable, SerialEncodable},
path::{expand_path, get_config_path},
},
Error, Result,
};

View File

@@ -3,9 +3,9 @@ use std::{cmp::Ordering, io};
use colored::Colorize;
use serde::{Deserialize, Serialize};
use darkfi::util::{
use darkfi::{
serial::{Decodable, Encodable, SerialDecodable, SerialEncodable, VarInt},
Timestamp,
util::time::Timestamp,
};
use crate::str_to_chars;
@@ -407,7 +407,7 @@ impl Patch {
}
impl Decodable for OpMethod {
fn decode<D: io::Read>(mut d: D) -> darkfi::Result<Self> {
fn decode<D: io::Read>(mut d: D) -> core::result::Result<Self, io::Error> {
let com: u8 = Decodable::decode(&mut d)?;
match com {
0 => {
@@ -422,13 +422,13 @@ impl Decodable for OpMethod {
let i: u64 = Decodable::decode(&mut d)?;
Ok(Self::Retain(i))
}
_ => Err(darkfi::Error::ParseFailed("Parse OpMethod failed")),
_ => Err(io::Error::new(io::ErrorKind::Other, "Parse OpMethod failed")),
}
}
}
impl Encodable for OpMethod {
fn encode<S: io::Write>(&self, mut s: S) -> darkfi::Result<usize> {
fn encode<S: io::Write>(&self, mut s: S) -> core::result::Result<usize, io::Error> {
let len: usize = match self {
Self::Delete(i) => (0_u8).encode(&mut s)? + i.encode(&mut s)?,
Self::Insert(t) => (1_u8).encode(&mut s)? + t.encode(&mut s)?,
@@ -439,7 +439,7 @@ impl Encodable for OpMethod {
}
impl Encodable for OpMethods {
fn encode<S: io::Write>(&self, mut s: S) -> darkfi::Result<usize> {
fn encode<S: io::Write>(&self, mut s: S) -> core::result::Result<usize, io::Error> {
let mut len = 0;
len += VarInt(self.0.len() as u64).encode(&mut s)?;
for c in self.0.iter() {
@@ -450,7 +450,7 @@ impl Encodable for OpMethods {
}
impl Decodable for OpMethods {
fn decode<D: io::Read>(mut d: D) -> darkfi::Result<Self> {
fn decode<D: io::Read>(mut d: D) -> core::result::Result<Self, io::Error> {
let len = VarInt::decode(&mut d)?.0;
let mut ret = Vec::with_capacity(len as usize);
for _ in 0..len {
@@ -463,9 +463,9 @@ impl Decodable for OpMethods {
#[cfg(test)]
mod tests {
use super::*;
use darkfi::util::{
gen_id,
use darkfi::{
serial::{deserialize, serialize},
util::gen_id,
};
#[test]