- Added assume_no_enum() because the Err enum is used at least as often as [] for reporting fails.

- changed substring(a b) behavior from "b is the max length of the resulting string" to "b is the exclusive end index, unless it is negative, in which case its abs() value is the maximum length".
- fixed a bug in libs/path
- added the http_requests library, which can be used to make very basic GET requests
- fixed a bug in the gui library that would mess up button handling
- you can now escape comments using a backslash `\`: \// will turn into the literal //, \/* will turn into the literal /*. Useful for URLs (because comments work in string literals). Putting a backslash before a linebreak will also ignore that linebreak (useful in long string literals)
This commit is contained in:
Dummi26
2023-04-13 03:04:47 +02:00
parent 2acdcd3f53
commit ce61749260
15 changed files with 1600 additions and 179 deletions

3
mers_libs/http_requests Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
cd ./http_requests_v1
cargo run --release

View File

@@ -1,49 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
dependencies = [
"memchr",
]
[[package]]
name = "http_requests"
version = "0.1.0"
dependencies = [
"mers",
]
[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "mers"
version = "0.1.0"
dependencies = [
"regex",
]
[[package]]
name = "regex"
version = "1.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"

View File

@@ -1,9 +0,0 @@
[package]
name = "http_requests"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
mers = { path = "../../mers/" }

View File

@@ -1,29 +0,0 @@
fn main() {
let (mut my_lib, mut run) = MyLib::new(
"GUI-Iced".to_string(),
(0, 0),
"A basic GUI library for mers.".to_string(),
vec![(
"http_get".to_string(),
vec![VSingleType::String],
VType {
types: vec![VSingleType::Tuple(vec![]), VSingleType::String],
},
)],
);
let mut stdin = std::io::stdin().lock();
let mut stdout = std::io::stdout().lock();
let mut layout = Layout::Row(vec![]);
loop {
run = match my_lib.run(run, &mut stdin, &mut stdout) {
MyLibTask::None(v) => v,
MyLibTask::RunFunction(mut f) => {
let return_value = match f.function {
0 => VDataEnum::List(VSingleType::Int.to(), vec![]).to(),
_ => unreachable!(),
};
f.done(&mut stdout, return_value)
}
}
}
}