Cleaned up warnings
This commit is contained in:
@@ -1,15 +1,9 @@
|
|||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use mlua::{FromLua, IntoLua, Lua, UserData, UserDataFields, Value};
|
use mlua::{FromLua, IntoLua, Lua, UserData, UserDataFields, Value};
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::PathBuf;
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use async_tftp::packet::Error;
|
use async_tftp::packet::Error;
|
||||||
use futures::TryFutureExt;
|
|
||||||
use tokio::sync::oneshot::error::RecvError;
|
|
||||||
|
|
||||||
pub struct LuaRunner {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
@@ -181,7 +175,7 @@ impl EngineImpl {
|
|||||||
.into_lua(lua)
|
.into_lua(lua)
|
||||||
.map_err(|err| Error::Msg(err.to_string()))?;
|
.map_err(|err| Error::Msg(err.to_string()))?;
|
||||||
let path = path.to_str().ok_or(Error::FileNotFound)?.to_owned();
|
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))
|
.call_async((path, lua_client.clone(), size))
|
||||||
.await
|
.await
|
||||||
.map_err(|err| Error::Msg(err.to_string()))?;
|
.map_err(|err| Error::Msg(err.to_string()))?;
|
||||||
@@ -200,8 +194,6 @@ impl Engine {
|
|||||||
pub fn new() -> anyhow::Result<(Self, EngineImpl)> {
|
pub fn new() -> anyhow::Result<(Self, EngineImpl)> {
|
||||||
let lua = Box::leak(Box::new(mlua::Lua::new()));
|
let lua = Box::leak(Box::new(mlua::Lua::new()));
|
||||||
// Add stdlib
|
// Add stdlib
|
||||||
let handler_fn = lua.create_registry_value(0)?;
|
|
||||||
|
|
||||||
let (req_snd, req_rcv) = tokio::sync::mpsc::channel(1);
|
let (req_snd, req_rcv) = tokio::sync::mpsc::channel(1);
|
||||||
|
|
||||||
let engine = Self {
|
let engine = Self {
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
use std::net::SocketAddr;
|
||||||
use std::future::Future;
|
use std::path::Path;
|
||||||
use std::path::{Path, PathBuf};
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use async_lock::Mutex;
|
|
||||||
use async_tftp::async_trait;
|
use async_tftp::async_trait;
|
||||||
use async_tftp::packet::Error;
|
use async_tftp::packet::Error;
|
||||||
use async_tftp::server::handlers::{DirHandler, DirHandlerMode};
|
use async_tftp::server::handlers::{DirHandler, DirHandlerMode};
|
||||||
use futures::{AsyncRead, AsyncWrite, TryStreamExt};
|
use futures::{AsyncRead, AsyncWrite, TryStreamExt};
|
||||||
use mlua::{FromLua, UserDataFields};
|
use reqwest::{Body, StatusCode};
|
||||||
use reqwest::Body;
|
|
||||||
use tokio_util::compat::TokioAsyncWriteCompatExt;
|
use tokio_util::compat::TokioAsyncWriteCompatExt;
|
||||||
use crate::engine::{Client, Engine, Resource};
|
use crate::engine::{Client, Engine, Resource};
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
local_set.spawn_local(engine_impl.run());
|
local_set.spawn_local(engine_impl.run());
|
||||||
|
|
||||||
let mut handler = handler::Handler::new(
|
let handler = handler::Handler::new(
|
||||||
engine.clone(),
|
engine.clone(),
|
||||||
opts.serve.as_ref()
|
opts.serve.as_ref()
|
||||||
.map(PathBuf::as_path)
|
.map(PathBuf::as_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user