feat: define Ctx to hold context (e.g. fs and net handles)
This commit is contained in:
parent
843c3eb8b2
commit
93158ea0a0
2 changed files with 19 additions and 2 deletions
|
@ -14,8 +14,8 @@ color-eyre = "0.6"
|
||||||
# "display",
|
# "display",
|
||||||
# "from",
|
# "from",
|
||||||
#] }
|
#] }
|
||||||
#kxio = {path = "../kxio/"}
|
# kxio = {path = "../kxio/"}
|
||||||
## kxio = "3.1"
|
kxio = "3.2"
|
||||||
#serde = { version = "1.0", features = ["derive"] }
|
#serde = { version = "1.0", features = ["derive"] }
|
||||||
#serde_json = "1.0"
|
#serde_json = "1.0"
|
||||||
tokio = { version = "1.41", features = ["full"] }
|
tokio = { version = "1.41", features = ["full"] }
|
||||||
|
|
17
src/lib.rs
17
src/lib.rs
|
@ -1 +1,18 @@
|
||||||
|
//
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
use kxio::{fs::FileSystem, net::Net};
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct Ctx {
|
||||||
|
pub fs: FileSystem,
|
||||||
|
pub net: Net,
|
||||||
|
}
|
||||||
|
impl Default for Ctx {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
fs: kxio::fs::new(PathBuf::default()),
|
||||||
|
net: kxio::net::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue