Cleaned up warnings

This commit is contained in:
2023-11-19 01:14:02 +01:00
parent e693909953
commit c638acecc2
3 changed files with 6 additions and 17 deletions

View File

@@ -1,15 +1,9 @@
use std::future::Future;
use mlua::{FromLua, IntoLua, Lua, UserData, UserDataFields, Value};
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::path::{Path, PathBuf};
use std::path::PathBuf;
use anyhow::anyhow;
use async_tftp::packet::Error;
use futures::TryFutureExt;
use tokio::sync::oneshot::error::RecvError;
pub struct LuaRunner {
}
#[derive(Clone, Debug)]
pub struct Client {
@@ -181,7 +175,7 @@ impl EngineImpl {
.into_lua(lua)
.map_err(|err| Error::Msg(err.to_string()))?;
let path = path.to_str().ok_or(Error::FileNotFound)?.to_owned();
let (resource, size): (Resource, Option<u64>) = resolver
let resource: Resource = resolver
.call_async((path, lua_client.clone(), size))
.await
.map_err(|err| Error::Msg(err.to_string()))?;
@@ -200,8 +194,6 @@ impl Engine {
pub fn new() -> anyhow::Result<(Self, EngineImpl)> {
let lua = Box::leak(Box::new(mlua::Lua::new()));
// Add stdlib
let handler_fn = lua.create_registry_value(0)?;
let (req_snd, req_rcv) = tokio::sync::mpsc::channel(1);
let engine = Self {

View File

@@ -1,15 +1,12 @@
// SPDX-License-Identifier: MIT
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::future::Future;
use std::path::{Path, PathBuf};
use std::net::SocketAddr;
use std::path::Path;
use std::sync::Arc;
use async_lock::Mutex;
use async_tftp::async_trait;
use async_tftp::packet::Error;
use async_tftp::server::handlers::{DirHandler, DirHandlerMode};
use futures::{AsyncRead, AsyncWrite, TryStreamExt};
use mlua::{FromLua, UserDataFields};
use reqwest::Body;
use reqwest::{Body, StatusCode};
use tokio_util::compat::TokioAsyncWriteCompatExt;
use crate::engine::{Client, Engine, Resource};

View File

@@ -43,7 +43,7 @@ async fn main() -> anyhow::Result<()> {
local_set.spawn_local(engine_impl.run());
let mut handler = handler::Handler::new(
let handler = handler::Handler::new(
engine.clone(),
opts.serve.as_ref()
.map(PathBuf::as_path)