From 0c6c8675a94ad0a798dc8b8d7d1167ab2c5c4101 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Thu, 23 May 2019 14:49:06 -0700 Subject: [PATCH 01/19] Add a std::fs replacement minimal no-op for wasm --- src/console/mod.rs | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/console/mod.rs b/src/console/mod.rs index 64a54bd3..2667424c 100644 --- a/src/console/mod.rs +++ b/src/console/mod.rs @@ -17,7 +17,40 @@ use std::collections::HashMap; use std::any::Any; use std::cell::{RefCell, Ref}; use std::sync::{Arc, Mutex}; -use std::fs; +use cfg_if::cfg_if; +cfg_if! { + if #[cfg(target_arch = "wasm32")] { + mod fs { + use log::info; + pub struct File {} + impl File { + pub fn open(path: &str) -> std::io::Result { + info!("fs open {}", path); + Ok(File{}) + } + pub fn create(path: &str) -> std::io::Result { + info!("fs create {}", path); + Ok(File{}) + } + } + impl std::io::Read for File { + fn read(&mut self, _buf: &mut [u8]) -> std::io::Result { + Ok(0) + } + } + impl std::io::Write for File { + fn write(&mut self, _buf: &[u8]) -> std::io::Result { + Ok(0) + } + fn flush(&mut self) -> std::io::Result<()> { + Ok(()) + } + } + } + } else { + use std::fs; + } +} use std::io::{BufWriter, Write, BufRead, BufReader}; use log; From a911c06287e43c35f6ae962083f77bc1991925d1 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Thu, 23 May 2019 19:38:16 -0700 Subject: [PATCH 02/19] Move web std::fs replacement to steven_std --- Cargo.lock | 8 ++++++++ Cargo.toml | 4 ++++ src/console/mod.rs | 28 +--------------------------- std/Cargo.lock | 6 ++++++ std/Cargo.toml | 8 ++++++++ std/src/lib.rs | 27 +++++++++++++++++++++++++++ 6 files changed, 54 insertions(+), 27 deletions(-) create mode 100644 std/Cargo.lock create mode 100644 std/Cargo.toml create mode 100644 std/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index f5142def..ce4eb92c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1894,6 +1894,13 @@ version = "0.1.0" name = "steven_shared" version = "0.0.1" +[[package]] +name = "steven_std" +version = "0.0.1" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "stevenarella" version = "0.0.1" @@ -1925,6 +1932,7 @@ dependencies = [ "steven_gl 0.0.1", "steven_resources 0.1.0", "steven_shared 0.0.1", + "steven_std 0.0.1", "structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 6b207290..132b6ec5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,3 +66,7 @@ version = "0" [dependencies.steven_shared] path = "./shared" version = "0" + +[dependencies.steven_std] +path = "./std" +version = "0" diff --git a/src/console/mod.rs b/src/console/mod.rs index 2667424c..1cc42d5d 100644 --- a/src/console/mod.rs +++ b/src/console/mod.rs @@ -20,33 +20,7 @@ use std::sync::{Arc, Mutex}; use cfg_if::cfg_if; cfg_if! { if #[cfg(target_arch = "wasm32")] { - mod fs { - use log::info; - pub struct File {} - impl File { - pub fn open(path: &str) -> std::io::Result { - info!("fs open {}", path); - Ok(File{}) - } - pub fn create(path: &str) -> std::io::Result { - info!("fs create {}", path); - Ok(File{}) - } - } - impl std::io::Read for File { - fn read(&mut self, _buf: &mut [u8]) -> std::io::Result { - Ok(0) - } - } - impl std::io::Write for File { - fn write(&mut self, _buf: &[u8]) -> std::io::Result { - Ok(0) - } - fn flush(&mut self) -> std::io::Result<()> { - Ok(()) - } - } - } + use steven_std::fs; } else { use std::fs; } diff --git a/std/Cargo.lock b/std/Cargo.lock new file mode 100644 index 00000000..cd0c1a5d --- /dev/null +++ b/std/Cargo.lock @@ -0,0 +1,6 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "steven_std" +version = "0.0.1" + diff --git a/std/Cargo.toml b/std/Cargo.toml new file mode 100644 index 00000000..76b9fc8f --- /dev/null +++ b/std/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "steven_std" +version = "0.0.1" +authors = [ "iceiix " ] +edition = "2018" + +[dependencies] +log = { version = "0.4.6", features = ["std"] } diff --git a/std/src/lib.rs b/std/src/lib.rs new file mode 100644 index 00000000..47f04db3 --- /dev/null +++ b/std/src/lib.rs @@ -0,0 +1,27 @@ +pub mod fs { + use log::info; + pub struct File {} + impl File { + pub fn open(path: &str) -> std::io::Result { + info!("fs open {}", path); + Ok(File{}) + } + pub fn create(path: &str) -> std::io::Result { + info!("fs create {}", path); + Ok(File{}) + } + } + impl std::io::Read for File { + fn read(&mut self, _buf: &mut [u8]) -> std::io::Result { + Ok(0) + } + } + impl std::io::Write for File { + fn write(&mut self, _buf: &[u8]) -> std::io::Result { + Ok(0) + } + fn flush(&mut self) -> std::io::Result<()> { + Ok(()) + } + } +} From 6f7f5a919464ee6c212846bfa1bbf552655b5537 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Thu, 23 May 2019 19:49:53 -0700 Subject: [PATCH 03/19] Import std::io Result, Read, Write --- std/src/lib.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/std/src/lib.rs b/std/src/lib.rs index 47f04db3..3958fc97 100644 --- a/std/src/lib.rs +++ b/std/src/lib.rs @@ -1,26 +1,28 @@ +use log::info; +use std::io::{Result, Read, Write}; + pub mod fs { - use log::info; pub struct File {} impl File { - pub fn open(path: &str) -> std::io::Result { + pub fn open(path: &str) -> Result { info!("fs open {}", path); Ok(File{}) } - pub fn create(path: &str) -> std::io::Result { + pub fn create(path: &str) -> Result { info!("fs create {}", path); Ok(File{}) } } - impl std::io::Read for File { - fn read(&mut self, _buf: &mut [u8]) -> std::io::Result { + impl Read for File { + fn read(&mut self, _buf: &mut [u8]) -> Result { Ok(0) } } - impl std::io::Write for File { - fn write(&mut self, _buf: &[u8]) -> std::io::Result { + impl Write for File { + fn write(&mut self, _buf: &[u8]) -> Result { Ok(0) } - fn flush(&mut self) -> std::io::Result<()> { + fn flush(&mut self) -> Result<()> { Ok(()) } } From 9c3660b6841893554a80173da597b75207beb621 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Thu, 23 May 2019 19:54:49 -0700 Subject: [PATCH 04/19] Change std::fs replacement to accept AsRef instead of &str --- std/Cargo.lock | 19 +++++++++++++++++++ std/src/lib.rs | 16 +++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/std/Cargo.lock b/std/Cargo.lock index cd0c1a5d..894ea5bb 100644 --- a/std/Cargo.lock +++ b/std/Cargo.lock @@ -1,6 +1,25 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "cfg-if" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "log" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "steven_std" version = "0.0.1" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] +[metadata] +"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" +"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" diff --git a/std/src/lib.rs b/std/src/lib.rs index 3958fc97..8e7412aa 100644 --- a/std/src/lib.rs +++ b/std/src/lib.rs @@ -1,15 +1,17 @@ -use log::info; -use std::io::{Result, Read, Write}; - pub mod fs { + use log::info; + use std::io::{Result, Read, Write}; + use std::path::Path; + use std::convert::AsRef; + pub struct File {} impl File { - pub fn open(path: &str) -> Result { - info!("fs open {}", path); + pub fn open>(path: P) -> Result { + info!("fs open {:?}", path.as_ref().to_str()); Ok(File{}) } - pub fn create(path: &str) -> Result { - info!("fs create {}", path); + pub fn create>(path: P) -> Result { + info!("fs create {:?}", path.as_ref().to_str()); Ok(File{}) } } From 6ee8619c20058a71c8b5ba356523be0e8fbd8b0b Mon Sep 17 00:00:00 2001 From: ice_iix Date: Thu, 23 May 2019 19:57:18 -0700 Subject: [PATCH 05/19] Implement std::io::Read on &File, in addition to File Interestingly, std::fs::File has both, too: https://github.com/rust-lang/rust/blob/8869ee03d7f258e1b76a11c6fbb01b5708a9f504/src/libstd/fs.rs#L647-L661 https://github.com/rust-lang/rust/blob/8869ee03d7f258e1b76a11c6fbb01b5708a9f504/src/libstd/fs.rs#L615-L628 Some explanation at https://stackoverflow.com/questions/28005134/how-do-i-implement-the-add-trait-for-a-reference-to-a-struct --- std/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/std/src/lib.rs b/std/src/lib.rs index 8e7412aa..57fa55ce 100644 --- a/std/src/lib.rs +++ b/std/src/lib.rs @@ -15,11 +15,18 @@ pub mod fs { Ok(File{}) } } + impl Read for File { fn read(&mut self, _buf: &mut [u8]) -> Result { Ok(0) } } + impl Read for &File { + fn read(&mut self, _buf: &mut [u8]) -> Result { + Ok(0) + } + } + impl Write for File { fn write(&mut self, _buf: &[u8]) -> Result { Ok(0) From ee7d18f192bcb5dac48e77748ef015fc016e8e0b Mon Sep 17 00:00:00 2001 From: ice_iix Date: Thu, 23 May 2019 19:59:02 -0700 Subject: [PATCH 06/19] Use std::fs wrapper everywhere, except build scripts --- src/protocol/mod.rs | 13 ++++++++++--- src/render/mod.rs | 9 ++++++++- src/resources.rs | 9 ++++++++- src/screen/edit_server.rs | 9 ++++++++- src/screen/server_list.rs | 9 ++++++++- 5 files changed, 42 insertions(+), 7 deletions(-) diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index 05143125..ea895ef2 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -19,8 +19,15 @@ use aes::Aes128; use cfb8::Cfb8; use cfb8::stream_cipher::{NewStreamCipher, StreamCipher}; use serde_json; -#[cfg(not(target_arch = "wasm32"))] -use reqwest; +use cfg_if::cfg_if; +cfg_if! { + if #[cfg(target_arch = "wasm32")] { + use steven_std::fs; + } else { + use std::fs; + use reqwest; + } +} pub mod mojang; pub mod forge; @@ -1070,7 +1077,7 @@ impl Conn { if network_debug { debug!("about to parse id={:x}, dir={:?} state={:?}", id, dir, self.state); - std::fs::File::create("last-packet")?.write_all(buf.get_ref())?; + fs::File::create("last-packet")?.write_all(buf.get_ref())?; } let packet = packet::packet_by_id(self.protocol_version, self.state, dir, id, &mut buf)?; diff --git a/src/render/mod.rs b/src/render/mod.rs index 2f0f1832..f5c3daec 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -865,7 +865,14 @@ impl TextureManager { #[cfg(not(target_arch = "wasm32"))] fn obtain_skin(client: &::reqwest::Client, hash: &str) -> Result { use std::io::Read; - use std::fs; + use cfg_if::cfg_if; + cfg_if! { + if #[cfg(target_arch = "wasm32")] { + use steven_std::fs; + } else { + use std::fs; + } + } use std::path::Path; use std::io::{Error, ErrorKind}; let path = format!("skin-cache/{}/{}.png", &hash[..2], hash); diff --git a/src/resources.rs b/src/resources.rs index 9b0683d1..0e474bad 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -14,10 +14,17 @@ extern crate steven_resources as internal; +use cfg_if::cfg_if; +cfg_if! { + if #[cfg(target_arch = "wasm32")] { + use steven_std::fs; + } else { + use std::fs; + } +} use std::thread; use std::path; use std::io; -use std::fs; use std::sync::mpsc; use std::sync::{Arc, Mutex}; use std::collections::HashMap; diff --git a/src/screen/edit_server.rs b/src/screen/edit_server.rs index 89f6b78a..01578d9b 100644 --- a/src/screen/edit_server.rs +++ b/src/screen/edit_server.rs @@ -12,7 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::fs; +use cfg_if::cfg_if; +cfg_if! { + if #[cfg(target_arch = "wasm32")] { + use steven_std::fs; + } else { + use std::fs; + } +} use std::collections::BTreeMap; use crate::ui; diff --git a/src/screen/server_list.rs b/src/screen/server_list.rs index 7381181c..c366175f 100644 --- a/src/screen/server_list.rs +++ b/src/screen/server_list.rs @@ -12,7 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::fs; +use cfg_if::cfg_if; +cfg_if! { + if #[cfg(target_arch = "wasm32")] { + use steven_std::fs; + } else { + use std::fs; + } +} use std::thread; use std::sync::mpsc; use std::rc::Rc; From 16472eda41856fd651638b148b88c98b0e078978 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Fri, 24 May 2019 09:04:18 -0700 Subject: [PATCH 07/19] Move cfg_if into steven_std --- Cargo.lock | 1 + src/console/mod.rs | 9 +-------- src/protocol/mod.rs | 12 +++--------- src/render/mod.rs | 9 +-------- src/resources.rs | 9 +-------- src/screen/edit_server.rs | 9 +-------- src/screen/server_list.rs | 9 +-------- std/Cargo.lock | 1 + std/Cargo.toml | 1 + std/src/lib.rs | 8 ++++++++ 10 files changed, 19 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ce4eb92c..a6aa2e6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1898,6 +1898,7 @@ version = "0.0.1" name = "steven_std" version = "0.0.1" dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/src/console/mod.rs b/src/console/mod.rs index 1cc42d5d..df7fea9f 100644 --- a/src/console/mod.rs +++ b/src/console/mod.rs @@ -17,14 +17,7 @@ use std::collections::HashMap; use std::any::Any; use std::cell::{RefCell, Ref}; use std::sync::{Arc, Mutex}; -use cfg_if::cfg_if; -cfg_if! { - if #[cfg(target_arch = "wasm32")] { - use steven_std::fs; - } else { - use std::fs; - } -} +use steven_std::fs; use std::io::{BufWriter, Write, BufRead, BufReader}; use log; diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index ea895ef2..d25f5b37 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -19,15 +19,9 @@ use aes::Aes128; use cfb8::Cfb8; use cfb8::stream_cipher::{NewStreamCipher, StreamCipher}; use serde_json; -use cfg_if::cfg_if; -cfg_if! { - if #[cfg(target_arch = "wasm32")] { - use steven_std::fs; - } else { - use std::fs; - use reqwest; - } -} +use steven_std::fs; +#[cfg(not(target_arch = "wasm32"))] +use reqwest; pub mod mojang; pub mod forge; diff --git a/src/render/mod.rs b/src/render/mod.rs index f5c3daec..7d555e49 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -865,14 +865,7 @@ impl TextureManager { #[cfg(not(target_arch = "wasm32"))] fn obtain_skin(client: &::reqwest::Client, hash: &str) -> Result { use std::io::Read; - use cfg_if::cfg_if; - cfg_if! { - if #[cfg(target_arch = "wasm32")] { - use steven_std::fs; - } else { - use std::fs; - } - } + use steven_std::fs; use std::path::Path; use std::io::{Error, ErrorKind}; let path = format!("skin-cache/{}/{}.png", &hash[..2], hash); diff --git a/src/resources.rs b/src/resources.rs index 0e474bad..a907217b 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -14,14 +14,7 @@ extern crate steven_resources as internal; -use cfg_if::cfg_if; -cfg_if! { - if #[cfg(target_arch = "wasm32")] { - use steven_std::fs; - } else { - use std::fs; - } -} +use steven_std::fs; use std::thread; use std::path; use std::io; diff --git a/src/screen/edit_server.rs b/src/screen/edit_server.rs index 01578d9b..405bc20c 100644 --- a/src/screen/edit_server.rs +++ b/src/screen/edit_server.rs @@ -12,14 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use cfg_if::cfg_if; -cfg_if! { - if #[cfg(target_arch = "wasm32")] { - use steven_std::fs; - } else { - use std::fs; - } -} +use steven_std::fs; use std::collections::BTreeMap; use crate::ui; diff --git a/src/screen/server_list.rs b/src/screen/server_list.rs index c366175f..e9dbf597 100644 --- a/src/screen/server_list.rs +++ b/src/screen/server_list.rs @@ -12,14 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use cfg_if::cfg_if; -cfg_if! { - if #[cfg(target_arch = "wasm32")] { - use steven_std::fs; - } else { - use std::fs; - } -} +use steven_std::fs; use std::thread; use std::sync::mpsc; use std::rc::Rc; diff --git a/std/Cargo.lock b/std/Cargo.lock index 894ea5bb..61cd7444 100644 --- a/std/Cargo.lock +++ b/std/Cargo.lock @@ -17,6 +17,7 @@ dependencies = [ name = "steven_std" version = "0.0.1" dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/std/Cargo.toml b/std/Cargo.toml index 76b9fc8f..79995f48 100644 --- a/std/Cargo.toml +++ b/std/Cargo.toml @@ -6,3 +6,4 @@ edition = "2018" [dependencies] log = { version = "0.4.6", features = ["std"] } +cfg-if = "0.1.9" diff --git a/std/src/lib.rs b/std/src/lib.rs index 57fa55ce..51a562e6 100644 --- a/std/src/lib.rs +++ b/std/src/lib.rs @@ -1,3 +1,7 @@ +use cfg_if::cfg_if; + +cfg_if! { + if #[cfg(target_arch = "wasm32")] { pub mod fs { use log::info; use std::io::{Result, Read, Write}; @@ -35,4 +39,8 @@ pub mod fs { Ok(()) } } +} + } else { + pub use std::fs; + } } From 625235af2e6b3261dd1de45420710f78fd373eee Mon Sep 17 00:00:00 2001 From: ice_iix Date: Fri, 24 May 2019 09:08:26 -0700 Subject: [PATCH 08/19] Rename to std_or_web --- Cargo.lock | 18 +++++++++--------- Cargo.toml | 4 ++-- src/console/mod.rs | 2 +- src/protocol/mod.rs | 2 +- src/render/mod.rs | 2 +- src/resources.rs | 2 +- src/screen/edit_server.rs | 2 +- src/screen/server_list.rs | 2 +- {std => std_or_web}/Cargo.lock | 0 {std => std_or_web}/Cargo.toml | 2 +- {std => std_or_web}/src/lib.rs | 0 11 files changed, 18 insertions(+), 18 deletions(-) rename {std => std_or_web}/Cargo.lock (100%) rename {std => std_or_web}/Cargo.toml (89%) rename {std => std_or_web}/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index a6aa2e6d..ead12e75 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1867,6 +1867,14 @@ dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "std_or_web" +version = "0.0.1" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "steven_blocks" version = "0.0.1" @@ -1894,14 +1902,6 @@ version = "0.1.0" name = "steven_shared" version = "0.0.1" -[[package]] -name = "steven_std" -version = "0.0.1" -dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "stevenarella" version = "0.0.1" @@ -1929,11 +1929,11 @@ dependencies = [ "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "std_or_web 0.0.1", "steven_blocks 0.0.1", "steven_gl 0.0.1", "steven_resources 0.1.0", "steven_shared 0.0.1", - "steven_std 0.0.1", "structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 132b6ec5..628183fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,6 +67,6 @@ version = "0" path = "./shared" version = "0" -[dependencies.steven_std] -path = "./std" +[dependencies.std_or_web] +path = "./std_or_web" version = "0" diff --git a/src/console/mod.rs b/src/console/mod.rs index df7fea9f..2fe14514 100644 --- a/src/console/mod.rs +++ b/src/console/mod.rs @@ -17,7 +17,7 @@ use std::collections::HashMap; use std::any::Any; use std::cell::{RefCell, Ref}; use std::sync::{Arc, Mutex}; -use steven_std::fs; +use std_or_web::fs; use std::io::{BufWriter, Write, BufRead, BufReader}; use log; diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index d25f5b37..18b251db 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -19,7 +19,7 @@ use aes::Aes128; use cfb8::Cfb8; use cfb8::stream_cipher::{NewStreamCipher, StreamCipher}; use serde_json; -use steven_std::fs; +use std_or_web::fs; #[cfg(not(target_arch = "wasm32"))] use reqwest; diff --git a/src/render/mod.rs b/src/render/mod.rs index 7d555e49..06139a62 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -865,7 +865,7 @@ impl TextureManager { #[cfg(not(target_arch = "wasm32"))] fn obtain_skin(client: &::reqwest::Client, hash: &str) -> Result { use std::io::Read; - use steven_std::fs; + use std_or_web::fs; use std::path::Path; use std::io::{Error, ErrorKind}; let path = format!("skin-cache/{}/{}.png", &hash[..2], hash); diff --git a/src/resources.rs b/src/resources.rs index a907217b..44a16c5b 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -14,7 +14,7 @@ extern crate steven_resources as internal; -use steven_std::fs; +use std_or_web::fs; use std::thread; use std::path; use std::io; diff --git a/src/screen/edit_server.rs b/src/screen/edit_server.rs index 405bc20c..f554fb87 100644 --- a/src/screen/edit_server.rs +++ b/src/screen/edit_server.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use steven_std::fs; +use std_or_web::fs; use std::collections::BTreeMap; use crate::ui; diff --git a/src/screen/server_list.rs b/src/screen/server_list.rs index e9dbf597..1544f0a7 100644 --- a/src/screen/server_list.rs +++ b/src/screen/server_list.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use steven_std::fs; +use std_or_web::fs; use std::thread; use std::sync::mpsc; use std::rc::Rc; diff --git a/std/Cargo.lock b/std_or_web/Cargo.lock similarity index 100% rename from std/Cargo.lock rename to std_or_web/Cargo.lock diff --git a/std/Cargo.toml b/std_or_web/Cargo.toml similarity index 89% rename from std/Cargo.toml rename to std_or_web/Cargo.toml index 79995f48..1c2cc164 100644 --- a/std/Cargo.toml +++ b/std_or_web/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "steven_std" +name = "std_or_web" version = "0.0.1" authors = [ "iceiix " ] edition = "2018" diff --git a/std/src/lib.rs b/std_or_web/src/lib.rs similarity index 100% rename from std/src/lib.rs rename to std_or_web/src/lib.rs From e2681391ab27b15883754841c41c42da9d96a4ad Mon Sep 17 00:00:00 2001 From: ice_iix Date: Fri, 24 May 2019 17:18:18 -0700 Subject: [PATCH 09/19] Add stdweb indexedbb dependency --- Cargo.lock | 70 +++++++++++++ std_or_web/Cargo.lock | 236 +++++++++++++++++++++++++++++++++++++++++- std_or_web/Cargo.toml | 3 + 3 files changed, 308 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index ead12e75..49306c4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -121,6 +121,11 @@ dependencies = [ "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base-x" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "base64" version = "0.10.1" @@ -504,6 +509,11 @@ dependencies = [ "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "dlib" version = "0.4.1" @@ -1800,6 +1810,11 @@ dependencies = [ "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "shared_library" version = "0.1.9" @@ -1873,8 +1888,56 @@ version = "0.0.1" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)", ] +[[package]] +name = "stdweb" +version = "0.4.17" +source = "git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547#aa4e6303697583aa4fdcfa837b10bd84110f4547" +dependencies = [ + "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)", + "stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)", + "stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)", + "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.1" +source = "git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547#aa4e6303697583aa4fdcfa837b10bd84110f4547" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.7" +source = "git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547#aa4e6303697583aa4fdcfa837b10bd84110f4547" +dependencies = [ + "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.4" +source = "git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547#aa4e6303697583aa4fdcfa837b10bd84110f4547" + [[package]] name = "steven_blocks" version = "0.0.1" @@ -2609,6 +2672,7 @@ dependencies = [ "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d55aa264e822dbafa12db4d54767aff17c6ba55ea2d8559b3e17392c7d000e5d" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80" "checksum bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f59bbe95d4e52a6398ec21238d31577f2b28a9d86807f06ca59d191d8440d0bb" @@ -2653,6 +2717,7 @@ dependencies = [ "checksum deflate 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)" = "8a6abb26e16e8d419b5c78662aa9f82857c2386a073da266840e474d5055ec86" "checksum derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6073e9676dbebdddeabaeb63e3b7cefd23c86f5c41d381ee1237cc77b1079898" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" +"checksum discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" "checksum dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a" "checksum downcast-rs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b92dfd5c2f75260cbf750572f95d387e7ca0ba5e3fbe9e1a33f23025be020f" "checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" @@ -2799,6 +2864,7 @@ dependencies = [ "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" "checksum serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" "checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" "checksum simple_asn1 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "57f6bbbcefb91c0dac9b27c91ba13bd2aa29a815fe980f5b1e07d523fbf7b350" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" @@ -2808,6 +2874,10 @@ dependencies = [ "checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum stb_truetype 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "69b7df505db8e81d54ff8be4693421e5b543e08214bd8d99eb761fcb4d5668ba" +"checksum stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)" = "" +"checksum stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)" = "" +"checksum stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)" = "" +"checksum stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)" = "" "checksum stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8861bc80f649f5b4c9bd38b696ae9af74499d479dbfb327f0607de6b326a36bc" "checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" diff --git a/std_or_web/Cargo.lock b/std_or_web/Cargo.lock index 61cd7444..02e0b07f 100644 --- a/std_or_web/Cargo.lock +++ b/std_or_web/Cargo.lock @@ -1,10 +1,35 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "base-x" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bumpalo" +version = "2.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cfg-if" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "itoa" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "log" version = "0.4.6" @@ -14,13 +39,222 @@ dependencies = [ ] [[package]] -name = "steven_std" +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ryu" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde_derive" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "std_or_web" version = "0.0.1" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", +] + +[[package]] +name = "stdweb" +version = "0.4.17" +source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +dependencies = [ + "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", + "stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", + "stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", + "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.1" +source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "stdweb-internal-macros" +version = "0.2.7" +source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +dependencies = [ + "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.4" +source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" + +[[package]] +name = "syn" +version = "0.15.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wasm-bindgen" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wasm-bindgen-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bumpalo 2.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" + [metadata] +"checksum base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d55aa264e822dbafa12db4d54767aff17c6ba55ea2d8559b3e17392c7d000e5d" +"checksum bumpalo 2.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "84dca3afd8e01b9526818b7963e5b4916063b3cdf9f10cf6b73ef0bd0ec37aa5" "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" +"checksum discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" +"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "a72e9b96fa45ce22a4bc23da3858dfccfd60acd28a25bcd328a98fdd6bea43fd" +"checksum serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "101b495b109a3e3ca8c4cbe44cf62391527cdfb6ba15821c5ce80bcd5ea23f9f" +"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +"checksum stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" +"checksum stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" +"checksum stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" +"checksum stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" +"checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "b7ccc7b93cfd13e26700a9e2e41e6305f1951b87e166599069f77d10358100e6" +"checksum wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "1953f91b1608eb1522513623c7739f047bb0fed4128ce51a93f08e12cc314645" +"checksum wasm-bindgen-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "0f69da5696545d7ca6607a2e4b1a0edf5a6b36b2c49dbb0f1df6ad1d92884047" +"checksum wasm-bindgen-macro-support 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d4246f3bc73223bbb846f4f2430a60725826a96c9389adf715ed1d5af46dec6" +"checksum wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "c08381e07e7a79e5e229ad7c60d15833d19033542cc5dd91d085df59d235f4a6" diff --git a/std_or_web/Cargo.toml b/std_or_web/Cargo.toml index 1c2cc164..7ef5e5ee 100644 --- a/std_or_web/Cargo.toml +++ b/std_or_web/Cargo.toml @@ -7,3 +7,6 @@ edition = "2018" [dependencies] log = { version = "0.4.6", features = ["std"] } cfg-if = "0.1.9" + +[target.'cfg(target_arch = "wasm32")'.dependencies] +stdweb = { git = "https://github.com/iceiix/stdweb", rev = "5f9ef949ab29e495b648ab9af79845f327ab1ed6" } From 7df26f61e786e4c90672e1e30332b7ae304996a5 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Fri, 24 May 2019 17:18:20 -0700 Subject: [PATCH 10/19] Revert "Add stdweb indexedbb dependency" This reverts commit e2681391ab27b15883754841c41c42da9d96a4ad. --- Cargo.lock | 70 ------------- std_or_web/Cargo.lock | 236 +----------------------------------------- std_or_web/Cargo.toml | 3 - 3 files changed, 1 insertion(+), 308 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 49306c4b..ead12e75 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -121,11 +121,6 @@ dependencies = [ "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "base-x" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "base64" version = "0.10.1" @@ -509,11 +504,6 @@ dependencies = [ "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "dlib" version = "0.4.1" @@ -1810,11 +1800,6 @@ dependencies = [ "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "shared_library" version = "0.1.9" @@ -1888,56 +1873,8 @@ version = "0.0.1" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)", ] -[[package]] -name = "stdweb" -version = "0.4.17" -source = "git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547#aa4e6303697583aa4fdcfa837b10bd84110f4547" -dependencies = [ - "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)", - "stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)", - "stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)", - "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.1" -source = "git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547#aa4e6303697583aa4fdcfa837b10bd84110f4547" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.7" -source = "git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547#aa4e6303697583aa4fdcfa837b10bd84110f4547" -dependencies = [ - "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.4" -source = "git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547#aa4e6303697583aa4fdcfa837b10bd84110f4547" - [[package]] name = "steven_blocks" version = "0.0.1" @@ -2672,7 +2609,6 @@ dependencies = [ "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" -"checksum base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d55aa264e822dbafa12db4d54767aff17c6ba55ea2d8559b3e17392c7d000e5d" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80" "checksum bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f59bbe95d4e52a6398ec21238d31577f2b28a9d86807f06ca59d191d8440d0bb" @@ -2717,7 +2653,6 @@ dependencies = [ "checksum deflate 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)" = "8a6abb26e16e8d419b5c78662aa9f82857c2386a073da266840e474d5055ec86" "checksum derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6073e9676dbebdddeabaeb63e3b7cefd23c86f5c41d381ee1237cc77b1079898" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" -"checksum discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" "checksum dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a" "checksum downcast-rs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b92dfd5c2f75260cbf750572f95d387e7ca0ba5e3fbe9e1a33f23025be020f" "checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" @@ -2864,7 +2799,6 @@ dependencies = [ "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" "checksum serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" "checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" -"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" "checksum simple_asn1 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "57f6bbbcefb91c0dac9b27c91ba13bd2aa29a815fe980f5b1e07d523fbf7b350" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" @@ -2874,10 +2808,6 @@ dependencies = [ "checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum stb_truetype 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "69b7df505db8e81d54ff8be4693421e5b543e08214bd8d99eb761fcb4d5668ba" -"checksum stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)" = "" -"checksum stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)" = "" -"checksum stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)" = "" -"checksum stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=aa4e6303697583aa4fdcfa837b10bd84110f4547)" = "" "checksum stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8861bc80f649f5b4c9bd38b696ae9af74499d479dbfb327f0607de6b326a36bc" "checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" diff --git a/std_or_web/Cargo.lock b/std_or_web/Cargo.lock index 02e0b07f..61cd7444 100644 --- a/std_or_web/Cargo.lock +++ b/std_or_web/Cargo.lock @@ -1,35 +1,10 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "base-x" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bumpalo" -version = "2.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "cfg-if" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "itoa" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "lazy_static" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "log" version = "0.4.6" @@ -39,222 +14,13 @@ dependencies = [ ] [[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ryu" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde_derive" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_json" -version = "1.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "std_or_web" +name = "steven_std" version = "0.0.1" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", -] - -[[package]] -name = "stdweb" -version = "0.4.17" -source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" -dependencies = [ - "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", - "stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", - "stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", - "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.1" -source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "stdweb-internal-macros" -version = "0.2.7" -source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" -dependencies = [ - "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.4" -source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" - -[[package]] -name = "syn" -version = "0.15.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wasm-bindgen" -version = "0.2.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wasm-bindgen-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bumpalo 2.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.45" -source = "registry+https://github.com/rust-lang/crates.io-index" - [metadata] -"checksum base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d55aa264e822dbafa12db4d54767aff17c6ba55ea2d8559b3e17392c7d000e5d" -"checksum bumpalo 2.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "84dca3afd8e01b9526818b7963e5b4916063b3cdf9f10cf6b73ef0bd0ec37aa5" "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" -"checksum discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" -"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" -"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" -"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "a72e9b96fa45ce22a4bc23da3858dfccfd60acd28a25bcd328a98fdd6bea43fd" -"checksum serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "101b495b109a3e3ca8c4cbe44cf62391527cdfb6ba15821c5ce80bcd5ea23f9f" -"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" -"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" -"checksum stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" -"checksum stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" -"checksum stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" -"checksum stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" -"checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "b7ccc7b93cfd13e26700a9e2e41e6305f1951b87e166599069f77d10358100e6" -"checksum wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "1953f91b1608eb1522513623c7739f047bb0fed4128ce51a93f08e12cc314645" -"checksum wasm-bindgen-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "0f69da5696545d7ca6607a2e4b1a0edf5a6b36b2c49dbb0f1df6ad1d92884047" -"checksum wasm-bindgen-macro-support 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d4246f3bc73223bbb846f4f2430a60725826a96c9389adf715ed1d5af46dec6" -"checksum wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "c08381e07e7a79e5e229ad7c60d15833d19033542cc5dd91d085df59d235f4a6" diff --git a/std_or_web/Cargo.toml b/std_or_web/Cargo.toml index 7ef5e5ee..1c2cc164 100644 --- a/std_or_web/Cargo.toml +++ b/std_or_web/Cargo.toml @@ -7,6 +7,3 @@ edition = "2018" [dependencies] log = { version = "0.4.6", features = ["std"] } cfg-if = "0.1.9" - -[target.'cfg(target_arch = "wasm32")'.dependencies] -stdweb = { git = "https://github.com/iceiix/stdweb", rev = "5f9ef949ab29e495b648ab9af79845f327ab1ed6" } From f8452caa3c903914867281b77f5bc45aa95f1063 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Fri, 24 May 2019 18:24:04 -0700 Subject: [PATCH 11/19] Add fs::File test in src/main.rs --- src/main.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main.rs b/src/main.rs index 05ec4371..08ecbb98 100644 --- a/src/main.rs +++ b/src/main.rs @@ -215,6 +215,26 @@ fn main2() { info!("Starting steven"); + { + use std_or_web::fs; + use std::io::{Read, Write}; + { + info!("creating"); + let mut f = fs::File::create("foo.txt").unwrap(); + info!("writing"); + f.write_all(b"Hello, world!").unwrap(); + } + { + info!("opening"); + let mut f = fs::File::open("foo.txt").unwrap(); + let mut contents = String::new(); + info!("reading"); + f.read_to_string(&mut contents).unwrap(); + info!("read data = {:?}", contents); + } + } + + let (vars, vsync) = { let mut vars = console::Vars::new(); vars.register(CL_BRAND); From 0899a437bc88c53d1d91fd1751191682c2264cc2 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Fri, 24 May 2019 18:24:18 -0700 Subject: [PATCH 12/19] Add localStorage-backed fs::File --- Cargo.lock | 71 ++++++++++++ std_or_web/Cargo.lock | 243 +++++++++++++++++++++++++++++++++++++++++- std_or_web/Cargo.toml | 4 + std_or_web/src/lib.rs | 72 +++++++++++-- 4 files changed, 379 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ead12e75..f03712b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -121,6 +121,11 @@ dependencies = [ "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base-x" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "base64" version = "0.10.1" @@ -504,6 +509,11 @@ dependencies = [ "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "dlib" version = "0.4.1" @@ -1800,6 +1810,11 @@ dependencies = [ "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "shared_library" version = "0.1.9" @@ -1872,9 +1887,58 @@ name = "std_or_web" version = "0.0.1" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", +] + +[[package]] +name = "stdweb" +version = "0.4.17" +source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +dependencies = [ + "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", + "stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", + "stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", + "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.1" +source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.7" +source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +dependencies = [ + "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.4" +source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" + [[package]] name = "steven_blocks" version = "0.0.1" @@ -2609,6 +2673,7 @@ dependencies = [ "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d55aa264e822dbafa12db4d54767aff17c6ba55ea2d8559b3e17392c7d000e5d" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80" "checksum bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f59bbe95d4e52a6398ec21238d31577f2b28a9d86807f06ca59d191d8440d0bb" @@ -2653,6 +2718,7 @@ dependencies = [ "checksum deflate 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)" = "8a6abb26e16e8d419b5c78662aa9f82857c2386a073da266840e474d5055ec86" "checksum derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6073e9676dbebdddeabaeb63e3b7cefd23c86f5c41d381ee1237cc77b1079898" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" +"checksum discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" "checksum dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a" "checksum downcast-rs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b92dfd5c2f75260cbf750572f95d387e7ca0ba5e3fbe9e1a33f23025be020f" "checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" @@ -2799,6 +2865,7 @@ dependencies = [ "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" "checksum serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" "checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" "checksum simple_asn1 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "57f6bbbcefb91c0dac9b27c91ba13bd2aa29a815fe980f5b1e07d523fbf7b350" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" @@ -2808,6 +2875,10 @@ dependencies = [ "checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum stb_truetype 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "69b7df505db8e81d54ff8be4693421e5b543e08214bd8d99eb761fcb4d5668ba" +"checksum stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" +"checksum stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" +"checksum stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" +"checksum stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" "checksum stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8861bc80f649f5b4c9bd38b696ae9af74499d479dbfb327f0607de6b326a36bc" "checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" diff --git a/std_or_web/Cargo.lock b/std_or_web/Cargo.lock index 61cd7444..aeb49b70 100644 --- a/std_or_web/Cargo.lock +++ b/std_or_web/Cargo.lock @@ -1,10 +1,40 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "base-x" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bumpalo" +version = "2.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cfg-if" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "hex" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "itoa" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "log" version = "0.4.6" @@ -14,13 +44,224 @@ dependencies = [ ] [[package]] -name = "steven_std" +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ryu" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde_derive" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "std_or_web" version = "0.0.1" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", ] +[[package]] +name = "stdweb" +version = "0.4.17" +source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +dependencies = [ + "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", + "stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", + "stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", + "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.1" +source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.7" +source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +dependencies = [ + "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.4" +source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" + +[[package]] +name = "syn" +version = "0.15.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wasm-bindgen" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wasm-bindgen-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bumpalo 2.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" + [metadata] +"checksum base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d55aa264e822dbafa12db4d54767aff17c6ba55ea2d8559b3e17392c7d000e5d" +"checksum bumpalo 2.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "84dca3afd8e01b9526818b7963e5b4916063b3cdf9f10cf6b73ef0bd0ec37aa5" "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" +"checksum discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" +"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" +"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "a72e9b96fa45ce22a4bc23da3858dfccfd60acd28a25bcd328a98fdd6bea43fd" +"checksum serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "101b495b109a3e3ca8c4cbe44cf62391527cdfb6ba15821c5ce80bcd5ea23f9f" +"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +"checksum stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" +"checksum stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" +"checksum stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" +"checksum stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" +"checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "b7ccc7b93cfd13e26700a9e2e41e6305f1951b87e166599069f77d10358100e6" +"checksum wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "1953f91b1608eb1522513623c7739f047bb0fed4128ce51a93f08e12cc314645" +"checksum wasm-bindgen-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "0f69da5696545d7ca6607a2e4b1a0edf5a6b36b2c49dbb0f1df6ad1d92884047" +"checksum wasm-bindgen-macro-support 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d4246f3bc73223bbb846f4f2430a60725826a96c9389adf715ed1d5af46dec6" +"checksum wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "c08381e07e7a79e5e229ad7c60d15833d19033542cc5dd91d085df59d235f4a6" diff --git a/std_or_web/Cargo.toml b/std_or_web/Cargo.toml index 1c2cc164..fc26cfef 100644 --- a/std_or_web/Cargo.toml +++ b/std_or_web/Cargo.toml @@ -7,3 +7,7 @@ edition = "2018" [dependencies] log = { version = "0.4.6", features = ["std"] } cfg-if = "0.1.9" + +[target.'cfg(target_arch = "wasm32")'.dependencies] +stdweb = { git = "https://github.com/iceiix/stdweb", rev = "5f9ef949ab29e495b648ab9af79845f327ab1ed6" } +hex = "0.3.2" diff --git a/std_or_web/src/lib.rs b/std_or_web/src/lib.rs index 51a562e6..85b5077c 100644 --- a/std_or_web/src/lib.rs +++ b/std_or_web/src/lib.rs @@ -7,33 +7,85 @@ pub mod fs { use std::io::{Result, Read, Write}; use std::path::Path; use std::convert::AsRef; + use stdweb::web::window; + use hex; + + pub struct File { + path: String, + offset: usize, + } - pub struct File {} impl File { pub fn open>(path: P) -> Result { - info!("fs open {:?}", path.as_ref().to_str()); - Ok(File{}) + let path: &str = path.as_ref().to_str().unwrap(); + info!("fs open {:?}", path); + + if !window().local_storage().contains_key(path) { + Err(std::io::Error::from_raw_os_error(1)) + } else { + Ok(File { path: path.to_string(), offset: 0 }) + } } pub fn create>(path: P) -> Result { - info!("fs create {:?}", path.as_ref().to_str()); - Ok(File{}) + let path: &str = path.as_ref().to_str().unwrap(); + info!("fs create {:?}", path); + + match window().local_storage().insert(path, "") { + Ok(_) => Ok(File { path: path.to_string(), offset: 0 }), + Err(_) => Err(std::io::Error::from_raw_os_error(1)), + } } } impl Read for File { - fn read(&mut self, _buf: &mut [u8]) -> Result { - Ok(0) + fn read(&mut self, buf: &mut [u8]) -> Result { + if let Some(string) = window().local_storage().get(&self.path) { + match hex::decode(&string) { + Ok(data) => { + info!("self.offset = {}", self.offset); + info!("buf.len() = {}", buf.len()); + + let mut end = self.offset + buf.len(); + if end > data.len() { + end = data.len(); + } + info!("data.len() = {}", data.len()); + info!("end = {}", end); + + info!("data = {:?}", data); + + let bytes = &data[self.offset..end]; + + info!("bytes = {:?}", bytes); + buf[..bytes.len()].copy_from_slice(&bytes); + self.offset = end; + Ok(bytes.len()) + }, + Err(_) => { + Err(std::io::Error::from_raw_os_error(8)) + } + } + } else { + Err(std::io::Error::from_raw_os_error(7)) + } } } impl Read for &File { fn read(&mut self, _buf: &mut [u8]) -> Result { - Ok(0) + //Ok(0) + unimplemented!() } } impl Write for File { - fn write(&mut self, _buf: &[u8]) -> Result { - Ok(0) + fn write(&mut self, buf: &[u8]) -> Result { + let string = window().local_storage().get(&self.path).unwrap(); + let new_string = string + &hex::encode(buf); + self.offset += buf.len(); + match window().local_storage().insert(&self.path, &new_string) { + Ok(_) => Ok(buf.len()), + Err(_) => Err(std::io::Error::from_raw_os_error(1)) + } } fn flush(&mut self) -> Result<()> { Ok(()) From f7ecc4a8194796c43190abc7147b7cb2263b2b11 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Fri, 24 May 2019 18:31:22 -0700 Subject: [PATCH 13/19] Remove creating foo.txt to demonstrate reading saved file --- src/main.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 08ecbb98..934af781 100644 --- a/src/main.rs +++ b/src/main.rs @@ -218,12 +218,6 @@ fn main2() { { use std_or_web::fs; use std::io::{Read, Write}; - { - info!("creating"); - let mut f = fs::File::create("foo.txt").unwrap(); - info!("writing"); - f.write_all(b"Hello, world!").unwrap(); - } { info!("opening"); let mut f = fs::File::open("foo.txt").unwrap(); From ae78f27b8e47f75df17e54532e30cacfc33d9529 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Fri, 24 May 2019 18:36:16 -0700 Subject: [PATCH 14/19] Remove src/main std_or_web test --- src/main.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/main.rs b/src/main.rs index 934af781..05ec4371 100644 --- a/src/main.rs +++ b/src/main.rs @@ -215,20 +215,6 @@ fn main2() { info!("Starting steven"); - { - use std_or_web::fs; - use std::io::{Read, Write}; - { - info!("opening"); - let mut f = fs::File::open("foo.txt").unwrap(); - let mut contents = String::new(); - info!("reading"); - f.read_to_string(&mut contents).unwrap(); - info!("read data = {:?}", contents); - } - } - - let (vars, vsync) = { let mut vars = console::Vars::new(); vars.register(CL_BRAND); From 5caffa027e2ee5cd6770b5afaf36099134288990 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Wed, 29 May 2019 07:31:16 -0700 Subject: [PATCH 15/19] Move to localstoragefs --- Cargo.lock | 34 +++++++++------- std_or_web/Cargo.lock | 34 +++++++++------- std_or_web/Cargo.toml | 4 +- std_or_web/src/lib.rs | 91 +------------------------------------------ 4 files changed, 42 insertions(+), 121 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 05edfc60..96d289c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -987,6 +987,14 @@ dependencies = [ "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "localstoragefs" +version = "0.1.0" +dependencies = [ + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "lock_api" version = "0.1.5" @@ -1887,30 +1895,28 @@ name = "std_or_web" version = "0.0.1" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", + "localstoragefs 0.1.0", ] [[package]] name = "stdweb" version = "0.4.17" -source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", - "stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", - "stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", + "stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-internal-macros 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-internal-runtime 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "stdweb-derive" version = "0.5.1" -source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1922,7 +1928,7 @@ dependencies = [ [[package]] name = "stdweb-internal-macros" version = "0.2.7" -source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1937,7 +1943,7 @@ dependencies = [ [[package]] name = "stdweb-internal-runtime" version = "0.1.4" -source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "steven_blocks" @@ -2875,10 +2881,10 @@ dependencies = [ "checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum stb_truetype 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "69b7df505db8e81d54ff8be4693421e5b543e08214bd8d99eb761fcb4d5668ba" -"checksum stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" -"checksum stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" -"checksum stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" -"checksum stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" +"checksum stdweb 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)" = "c34362bb10ac1a9439674795cc0e1bdcb0c46444c8fd4874ef39a01d9a8a8f24" +"checksum stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e21ebd9179de08f2300a65454268a17ea3de204627458588c84319c4def3930" +"checksum stdweb-internal-macros 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e68f7d08b76979a43e93fe043b66d2626e35d41d68b0b85519202c6dd8ac59fa" +"checksum stdweb-internal-runtime 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d52317523542cc0af5b7e31017ad0f7d1e78da50455e38d5657cd17754f617da" "checksum stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8861bc80f649f5b4c9bd38b696ae9af74499d479dbfb327f0607de6b326a36bc" "checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" diff --git a/std_or_web/Cargo.lock b/std_or_web/Cargo.lock index aeb49b70..ec3074f0 100644 --- a/std_or_web/Cargo.lock +++ b/std_or_web/Cargo.lock @@ -35,6 +35,14 @@ name = "lazy_static" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "localstoragefs" +version = "0.1.0" +dependencies = [ + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "log" version = "0.4.6" @@ -120,30 +128,28 @@ name = "std_or_web" version = "0.0.1" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", + "localstoragefs 0.1.0", ] [[package]] name = "stdweb" version = "0.4.17" -source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", - "stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", - "stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)", + "stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-internal-macros 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-internal-runtime 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "stdweb-derive" version = "0.5.1" -source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -155,7 +161,7 @@ dependencies = [ [[package]] name = "stdweb-internal-macros" version = "0.2.7" -source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -170,7 +176,7 @@ dependencies = [ [[package]] name = "stdweb-internal-runtime" version = "0.1.4" -source = "git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6#5f9ef949ab29e495b648ab9af79845f327ab1ed6" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" @@ -254,10 +260,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "101b495b109a3e3ca8c4cbe44cf62391527cdfb6ba15821c5ce80bcd5ea23f9f" "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" -"checksum stdweb 0.4.17 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" -"checksum stdweb-derive 0.5.1 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" -"checksum stdweb-internal-macros 0.2.7 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" -"checksum stdweb-internal-runtime 0.1.4 (git+https://github.com/iceiix/stdweb?rev=5f9ef949ab29e495b648ab9af79845f327ab1ed6)" = "" +"checksum stdweb 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)" = "c34362bb10ac1a9439674795cc0e1bdcb0c46444c8fd4874ef39a01d9a8a8f24" +"checksum stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e21ebd9179de08f2300a65454268a17ea3de204627458588c84319c4def3930" +"checksum stdweb-internal-macros 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e68f7d08b76979a43e93fe043b66d2626e35d41d68b0b85519202c6dd8ac59fa" +"checksum stdweb-internal-runtime 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d52317523542cc0af5b7e31017ad0f7d1e78da50455e38d5657cd17754f617da" "checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "b7ccc7b93cfd13e26700a9e2e41e6305f1951b87e166599069f77d10358100e6" diff --git a/std_or_web/Cargo.toml b/std_or_web/Cargo.toml index fc26cfef..9cb3339f 100644 --- a/std_or_web/Cargo.toml +++ b/std_or_web/Cargo.toml @@ -5,9 +5,7 @@ authors = [ "iceiix " ] edition = "2018" [dependencies] -log = { version = "0.4.6", features = ["std"] } cfg-if = "0.1.9" [target.'cfg(target_arch = "wasm32")'.dependencies] -stdweb = { git = "https://github.com/iceiix/stdweb", rev = "5f9ef949ab29e495b648ab9af79845f327ab1ed6" } -hex = "0.3.2" +localstoragefs = { path = "../../localstoragefs" } diff --git a/std_or_web/src/lib.rs b/std_or_web/src/lib.rs index 85b5077c..e8d3d040 100644 --- a/std_or_web/src/lib.rs +++ b/std_or_web/src/lib.rs @@ -2,96 +2,7 @@ use cfg_if::cfg_if; cfg_if! { if #[cfg(target_arch = "wasm32")] { -pub mod fs { - use log::info; - use std::io::{Result, Read, Write}; - use std::path::Path; - use std::convert::AsRef; - use stdweb::web::window; - use hex; - - pub struct File { - path: String, - offset: usize, - } - - impl File { - pub fn open>(path: P) -> Result { - let path: &str = path.as_ref().to_str().unwrap(); - info!("fs open {:?}", path); - - if !window().local_storage().contains_key(path) { - Err(std::io::Error::from_raw_os_error(1)) - } else { - Ok(File { path: path.to_string(), offset: 0 }) - } - } - pub fn create>(path: P) -> Result { - let path: &str = path.as_ref().to_str().unwrap(); - info!("fs create {:?}", path); - - match window().local_storage().insert(path, "") { - Ok(_) => Ok(File { path: path.to_string(), offset: 0 }), - Err(_) => Err(std::io::Error::from_raw_os_error(1)), - } - } - } - - impl Read for File { - fn read(&mut self, buf: &mut [u8]) -> Result { - if let Some(string) = window().local_storage().get(&self.path) { - match hex::decode(&string) { - Ok(data) => { - info!("self.offset = {}", self.offset); - info!("buf.len() = {}", buf.len()); - - let mut end = self.offset + buf.len(); - if end > data.len() { - end = data.len(); - } - info!("data.len() = {}", data.len()); - info!("end = {}", end); - - info!("data = {:?}", data); - - let bytes = &data[self.offset..end]; - - info!("bytes = {:?}", bytes); - buf[..bytes.len()].copy_from_slice(&bytes); - self.offset = end; - Ok(bytes.len()) - }, - Err(_) => { - Err(std::io::Error::from_raw_os_error(8)) - } - } - } else { - Err(std::io::Error::from_raw_os_error(7)) - } - } - } - impl Read for &File { - fn read(&mut self, _buf: &mut [u8]) -> Result { - //Ok(0) - unimplemented!() - } - } - - impl Write for File { - fn write(&mut self, buf: &[u8]) -> Result { - let string = window().local_storage().get(&self.path).unwrap(); - let new_string = string + &hex::encode(buf); - self.offset += buf.len(); - match window().local_storage().insert(&self.path, &new_string) { - Ok(_) => Ok(buf.len()), - Err(_) => Err(std::io::Error::from_raw_os_error(1)) - } - } - fn flush(&mut self) -> Result<()> { - Ok(()) - } - } -} + pub use localstoragefs::fs; } else { pub use std::fs; } From 42ea9ede41f7d37009a6cf8a4a9a48af0ecb14e0 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Wed, 29 May 2019 08:02:53 -0700 Subject: [PATCH 16/19] Update to published localstoragefs 0.1.0 crate https://github.com/iceiix/localstoragefs --- Cargo.lock | 4 +++- std_or_web/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 96d289c0..9782b236 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -990,6 +990,7 @@ dependencies = [ [[package]] name = "localstoragefs" version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "stdweb 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1895,7 +1896,7 @@ name = "std_or_web" version = "0.0.1" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "localstoragefs 0.1.0", + "localstoragefs 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2780,6 +2781,7 @@ dependencies = [ "checksum libflate 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "c52384aeb22d0ce82a10d8ddf35f7fb4717d1b23eac5b94cd38d2050fb53766a" "checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" "checksum line_drawing 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5cc7ad3d82c845bdb5dde34ffdcc7a5fb4d2996e1e1ee0f19c33bc80e15196b9" +"checksum localstoragefs 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba6cbee6bbe7e6ea61ad375952239a9678624f216a0f442ae04a90260e76cdf" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" diff --git a/std_or_web/Cargo.toml b/std_or_web/Cargo.toml index 9cb3339f..3792b7f4 100644 --- a/std_or_web/Cargo.toml +++ b/std_or_web/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" cfg-if = "0.1.9" [target.'cfg(target_arch = "wasm32")'.dependencies] -localstoragefs = { path = "../../localstoragefs" } +localstoragefs = "0.1.0" From d24f6727cec2a8644ca0c126939bc64b66748a75 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Wed, 29 May 2019 08:13:04 -0700 Subject: [PATCH 17/19] Update www readme for new missing glutin/winit links --- www/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/README.md b/www/README.md index 3eb33d9b..ab5dadcb 100644 --- a/www/README.md +++ b/www/README.md @@ -5,8 +5,8 @@ Web app for running Stevenarella as WebAssembly Status: very incomplete. It currently compiles, but **does not run** due to missing web support from critical dependencies, at least: -* [glutin](https://github.com/tomaka/glutin) (temporary stub: [#1](https://github.com/iceiix/glutin/pull/1)) -* [winit](https://github.com/tomaka/winit), watch for [stdweb suoort](https://github.com/tomaka/winit/pull/797) (temporary stub: [#2](https://github.com/iceiix/winit/pull/2)) +* [glutin](https://github.com/rust-windowing/glutin) (temporary stub: [#1](https://github.com/iceiix/glutin/pull/1)) +* [winit](https://github.com/rust-windowing/winit), watch for [stdweb support](https://github.com/tomaka/winit/pull/797)or [wasm_bindgen backend for eventloop-2.0](https://github.com/rust-windowing/winit/pull/845) (temporary stub: [#2](https://github.com/iceiix/winit/pull/2)) ## Building From f830e8302c43f11389672b35fcae5884f5e9fef8 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Wed, 29 May 2019 08:15:11 -0700 Subject: [PATCH 18/19] Remove unnecessary change in import ordering --- src/resources.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources.rs b/src/resources.rs index 44a16c5b..8f932494 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -14,10 +14,10 @@ extern crate steven_resources as internal; -use std_or_web::fs; use std::thread; use std::path; use std::io; +use std_or_web::fs; use std::sync::mpsc; use std::sync::{Arc, Mutex}; use std::collections::HashMap; From 0e171fadd420257ad9962f53ac0cfafebf32dc5d Mon Sep 17 00:00:00 2001 From: ice_iix Date: Wed, 29 May 2019 08:17:12 -0700 Subject: [PATCH 19/19] Fix whitespace and cleanup wording --- www/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/README.md b/www/README.md index ab5dadcb..73955ba8 100644 --- a/www/README.md +++ b/www/README.md @@ -6,7 +6,7 @@ Status: very incomplete. It currently compiles, but **does not run** due to missing web support from critical dependencies, at least: * [glutin](https://github.com/rust-windowing/glutin) (temporary stub: [#1](https://github.com/iceiix/glutin/pull/1)) -* [winit](https://github.com/rust-windowing/winit), watch for [stdweb support](https://github.com/tomaka/winit/pull/797)or [wasm_bindgen backend for eventloop-2.0](https://github.com/rust-windowing/winit/pull/845) (temporary stub: [#2](https://github.com/iceiix/winit/pull/2)) +* [winit](https://github.com/rust-windowing/winit), watch for [stdweb](https://github.com/tomaka/winit/pull/797) or [wasm_bindgen](https://github.com/rust-windowing/winit/pull/845) support (temporary stub: [#2](https://github.com/iceiix/winit/pull/2)) ## Building