updates (#323)
Reviewed-on: #323 Co-authored-by: Greg Burd <greg@burd.me> Co-committed-by: Greg Burd <greg@burd.me>
This commit is contained in:
parent
216f078d44
commit
201ec39dd2
16 changed files with 65 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
authors = [
|
authors = [
|
||||||
"Richard Newman <rnewman@twinql.com>",
|
"Richard Newman <rnewman@twinql.com>",
|
||||||
"Nicholas Alexander <nalexander@mozilla.com>",
|
"Nicholas Alexander <nalexander@mozilla.com>",
|
||||||
|
@ -14,7 +14,7 @@ authors = [
|
||||||
"Gregory Burd <greg@burd.me>",
|
"Gregory Burd <greg@burd.me>",
|
||||||
]
|
]
|
||||||
name = "mentat"
|
name = "mentat"
|
||||||
version = "0.13.0"
|
version = "0.14.0"
|
||||||
build = "build/version.rs"
|
build = "build/version.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -50,7 +50,7 @@ failure = "~0.1"
|
||||||
lazy_static = "~1.4"
|
lazy_static = "~1.4"
|
||||||
time = "0.3.1"
|
time = "0.3.1"
|
||||||
log = "~0.4"
|
log = "~0.4"
|
||||||
uuid = { version = "~1.0", features = ["v4", "serde"] }
|
uuid = { version = "~1", features = ["v4", "serde"] }
|
||||||
|
|
||||||
[dependencies.rusqlite]
|
[dependencies.rusqlite]
|
||||||
version = "~0.29"
|
version = "~0.29"
|
||||||
|
|
3
Makefile
3
Makefile
|
@ -1,3 +1,4 @@
|
||||||
|
.PHONY: outdated fix
|
||||||
|
|
||||||
outdated:
|
outdated:
|
||||||
for p in $(dirname $(ls Cargo.toml */Cargo.toml */*/Cargo.toml)); do echo $p; (cd $p; cargo outdated -R); done
|
for p in $(dirname $(ls Cargo.toml */Cargo.toml */*/Cargo.toml)); do echo $p; (cd $p; cargo outdated -R); done
|
||||||
|
@ -6,3 +7,5 @@ outdated:
|
||||||
fix:
|
fix:
|
||||||
$(for p in $(dirname $(ls Cargo.toml */Cargo.toml */*/Cargo.toml)); do echo $p; (cd $p; cargo fix --allow-dirty --broken-code --edition-idioms); done)
|
$(for p in $(dirname $(ls Cargo.toml */Cargo.toml */*/Cargo.toml)); do echo $p; (cd $p; cargo fix --allow-dirty --broken-code --edition-idioms); done)
|
||||||
|
|
||||||
|
upgrades:
|
||||||
|
cargo upgrades
|
||||||
|
|
|
@ -14,7 +14,7 @@ use std::process::exit;
|
||||||
|
|
||||||
/// MIN_VERSION should be changed when there's a new minimum version of rustc required
|
/// MIN_VERSION should be changed when there's a new minimum version of rustc required
|
||||||
/// to build the project.
|
/// to build the project.
|
||||||
static MIN_VERSION: &str = "1.43.0";
|
static MIN_VERSION: &str = "1.69.0";
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let ver = version().unwrap();
|
let ver = version().unwrap();
|
||||||
|
|
|
@ -13,7 +13,7 @@ enum-set = "~0.0.8"
|
||||||
lazy_static = "~1.4"
|
lazy_static = "~1.4"
|
||||||
indexmap = "~1.9"
|
indexmap = "~1.9"
|
||||||
ordered-float = { version = "~2.8", features = ["serde"] }
|
ordered-float = { version = "~2.8", features = ["serde"] }
|
||||||
uuid = { version = "~1.0", features = ["v4", "serde"] }
|
uuid = { version = "~1", features = ["v4", "serde"] }
|
||||||
serde = { version = "~1.0", features = ["rc"] }
|
serde = { version = "~1.0", features = ["rc"] }
|
||||||
serde_derive = "~1.0"
|
serde_derive = "~1.0"
|
||||||
bytes = { version = "1.0.1", features = ["serde"] }
|
bytes = { version = "1.0.1", features = ["serde"] }
|
||||||
|
|
|
@ -9,7 +9,7 @@ enum-set = "~0.0"
|
||||||
failure = "~0.1"
|
failure = "~0.1"
|
||||||
indexmap = "~1.9"
|
indexmap = "~1.9"
|
||||||
ordered-float = { version = "~2.8", features = ["serde"] }
|
ordered-float = { version = "~2.8", features = ["serde"] }
|
||||||
uuid = { version = "~1.0", features = ["v4", "serde"] }
|
uuid = { version = "~1", features = ["v4", "serde"] }
|
||||||
|
|
||||||
[dependencies.core_traits]
|
[dependencies.core_traits]
|
||||||
path = "../core-traits"
|
path = "../core-traits"
|
||||||
|
|
|
@ -15,7 +15,7 @@ itertools = "~0.10"
|
||||||
num = "~0.4"
|
num = "~0.4"
|
||||||
ordered-float = "~2.8"
|
ordered-float = "~2.8"
|
||||||
pretty = "~0.12"
|
pretty = "~0.12"
|
||||||
uuid = { version = "~1.0", features = ["v4", "serde"] }
|
uuid = { version = "~1", features = ["v4", "serde"] }
|
||||||
serde = { version = "~1.0", optional = true }
|
serde = { version = "~1.0", optional = true }
|
||||||
serde_derive = { version = "~1.0", optional = true }
|
serde_derive = { version = "~1.0", optional = true }
|
||||||
peg = "~0.8"
|
peg = "~0.8"
|
||||||
|
|
|
@ -128,7 +128,7 @@ peg::parser!(pub grammar parse() for str {
|
||||||
// result = r#""foo\\bar""#
|
// result = r#""foo\\bar""#
|
||||||
// For the typical case, string_normal_chars will match multiple, leading to a single-element vec.
|
// For the typical case, string_normal_chars will match multiple, leading to a single-element vec.
|
||||||
pub rule raw_text() -> String = "\"" t:((string_special_char() / string_normal_chars())*) "\""
|
pub rule raw_text() -> String = "\"" t:((string_special_char() / string_normal_chars())*) "\""
|
||||||
{ t.join(&"") }
|
{ t.join("") }
|
||||||
|
|
||||||
pub rule text() -> SpannedValue
|
pub rule text() -> SpannedValue
|
||||||
= v:raw_text() { SpannedValue::Text(v) }
|
= v:raw_text() { SpannedValue::Text(v) }
|
||||||
|
@ -153,16 +153,16 @@ peg::parser!(pub grammar parse() for str {
|
||||||
"#instmicros" whitespace()+ d:$( digit()+ ) {
|
"#instmicros" whitespace()+ d:$( digit()+ ) {
|
||||||
let micros = d.parse::<i64>().unwrap();
|
let micros = d.parse::<i64>().unwrap();
|
||||||
let seconds: i64 = micros / 1_000_000;
|
let seconds: i64 = micros / 1_000_000;
|
||||||
let nanos: u32 = ((micros % 1_000_000).abs() as u32) * 1000;
|
let nanos: u32 = ((micros % 1_000_000).unsigned_abs() as u32) * 1000;
|
||||||
Utc.timestamp(seconds, nanos)
|
Utc.timestamp_opt(seconds, nanos).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
rule inst_millis() -> DateTime<Utc> =
|
rule inst_millis() -> DateTime<Utc> =
|
||||||
"#instmillis" whitespace()+ d:$( digit()+ ) {
|
"#instmillis" whitespace()+ d:$( digit()+ ) {
|
||||||
let millis = d.parse::<i64>().unwrap();
|
let millis = d.parse::<i64>().unwrap();
|
||||||
let seconds: i64 = millis / 1000;
|
let seconds: i64 = millis / 1000;
|
||||||
let nanos: u32 = ((millis % 1000).abs() as u32) * 1_000_000;
|
let nanos: u32 = ((millis % 1000).unsigned_abs() as u32) * 1_000_000;
|
||||||
Utc.timestamp(seconds, nanos)
|
Utc.timestamp_opt(seconds, nanos).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
rule inst() -> SpannedValue = t:(inst_millis() / inst_micros() / inst_string())
|
rule inst() -> SpannedValue = t:(inst_millis() / inst_micros() / inst_string())
|
||||||
|
|
|
@ -121,7 +121,7 @@ impl NamespaceableName {
|
||||||
if name.starts_with('_') {
|
if name.starts_with('_') {
|
||||||
Self::new(self.namespace(), &name[1..])
|
Self::new(self.namespace(), &name[1..])
|
||||||
} else {
|
} else {
|
||||||
Self::new(self.namespace(), &format!("_{}", name))
|
Self::new(self.namespace(), format!("_{}", name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1028,8 +1028,8 @@ impl ParsedQuery {
|
||||||
Ok(ParsedQuery {
|
Ok(ParsedQuery {
|
||||||
find_spec: find_spec.ok_or("expected :find")?,
|
find_spec: find_spec.ok_or("expected :find")?,
|
||||||
default_source: SrcVar::DefaultSrc,
|
default_source: SrcVar::DefaultSrc,
|
||||||
with: with.unwrap_or_else(Vec::new), //
|
with: with.unwrap_or_default(),
|
||||||
in_vars: in_vars.unwrap_or_else(Vec::new),
|
in_vars: in_vars.unwrap_or_default(),
|
||||||
in_sources: BTreeSet::default(),
|
in_sources: BTreeSet::default(),
|
||||||
limit: limit.unwrap_or(Limit::None),
|
limit: limit.unwrap_or(Limit::None),
|
||||||
where_clauses: where_clauses.ok_or("expected :where")?,
|
where_clauses: where_clauses.ok_or("expected :where")?,
|
||||||
|
|
|
@ -668,7 +668,7 @@ pub trait FromMicros {
|
||||||
|
|
||||||
impl FromMicros for DateTime<Utc> {
|
impl FromMicros for DateTime<Utc> {
|
||||||
fn from_micros(ts: i64) -> Self {
|
fn from_micros(ts: i64) -> Self {
|
||||||
Utc.timestamp(ts / 1_000_000, ((ts % 1_000_000).abs() as u32) * 1_000)
|
Utc.timestamp_opt(ts / 1_000_000, ((ts % 1_000_000).unsigned_abs() as u32) * 1_000).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -690,7 +690,7 @@ pub trait FromMillis {
|
||||||
|
|
||||||
impl FromMillis for DateTime<Utc> {
|
impl FromMillis for DateTime<Utc> {
|
||||||
fn from_millis(ts: i64) -> Self {
|
fn from_millis(ts: i64) -> Self {
|
||||||
Utc.timestamp(ts / 1_000, ((ts % 1_000).abs() as u32) * 1_000)
|
Utc.timestamp_opt(ts / 1_000, ((ts % 1_000).unsigned_abs() as u32) * 1_000).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,9 @@ use crate::types::Value;
|
||||||
/// TODO: implement `merge` for [Value], following the `concat`/`SliceConcatExt` pattern.
|
/// TODO: implement `merge` for [Value], following the `concat`/`SliceConcatExt` pattern.
|
||||||
pub fn merge(left: &Value, right: &Value) -> Option<Value> {
|
pub fn merge(left: &Value, right: &Value) -> Option<Value> {
|
||||||
match (left, right) {
|
match (left, right) {
|
||||||
(&Value::Map(ref l), &Value::Map(ref r)) => {
|
(Value::Map(l), Value::Map(r)) => {
|
||||||
let mut result = l.clone();
|
let mut result = l.clone();
|
||||||
result.extend(r.clone().into_iter());
|
result.extend(r.clone());
|
||||||
Some(Value::Map(result))
|
Some(Value::Map(result))
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|
1
rust-toolchain
Normal file
1
rust-toolchain
Normal file
|
@ -0,0 +1 @@
|
||||||
|
nightly-2023-11-27
|
38
shell.nix
Normal file
38
shell.nix
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
pkgs.mkShell rec {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
# Necessary for the openssl-sys crate:
|
||||||
|
pkgs.openssl
|
||||||
|
pkgs.pkg-config
|
||||||
|
# Compiler
|
||||||
|
clang
|
||||||
|
# Replace llvmPackages with llvmPackages_X, where X is the latest LLVM version (at the time of writing, 16)
|
||||||
|
llvmPackages.bintools
|
||||||
|
rustup
|
||||||
|
];
|
||||||
|
RUSTC_VERSION = pkgs.lib.readFile ./rust-toolchain;
|
||||||
|
# https://github.com/rust-lang/rust-bindgen#environment-variables
|
||||||
|
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ];
|
||||||
|
shellHook = ''
|
||||||
|
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
|
||||||
|
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/
|
||||||
|
'';
|
||||||
|
# Add precompiled library to rustc search path
|
||||||
|
RUSTFLAGS = (builtins.map (a: ''-L ${a}/lib'') [
|
||||||
|
# add libraries here (e.g. pkgs.libvmi)
|
||||||
|
]);
|
||||||
|
# Add glibc, clang, glib and other headers to bindgen search path
|
||||||
|
BINDGEN_EXTRA_CLANG_ARGS =
|
||||||
|
# Includes with normal include path
|
||||||
|
(builtins.map (a: ''-I"${a}/include"'') [
|
||||||
|
# add dev libraries here (e.g. pkgs.libvmi.dev)
|
||||||
|
pkgs.glibc.dev
|
||||||
|
])
|
||||||
|
# Includes with special directory paths
|
||||||
|
++ [
|
||||||
|
''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"''
|
||||||
|
''-I"${pkgs.glib.dev}/include/glib-2.0"''
|
||||||
|
''-I${pkgs.glib.out}/lib/glib-2.0/include/''
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
|
@ -254,7 +254,7 @@ fn test_unbound_inputs() {
|
||||||
fn test_instants_and_uuids() {
|
fn test_instants_and_uuids() {
|
||||||
// We assume, perhaps foolishly, that the clocks on test machines won't lose more than an
|
// We assume, perhaps foolishly, that the clocks on test machines won't lose more than an
|
||||||
// hour while this test is running.
|
// hour while this test is running.
|
||||||
let start = Utc::now() + FixedOffset::west(60 * 60);
|
let start = Utc::now() + FixedOffset::west_opt(60 * 60).unwrap();
|
||||||
|
|
||||||
let mut c = new_connection("").expect("Couldn't open conn.");
|
let mut c = new_connection("").expect("Couldn't open conn.");
|
||||||
let mut conn = Conn::connect(&mut c).expect("Couldn't open DB.");
|
let mut conn = Conn::connect(&mut c).expect("Couldn't open DB.");
|
||||||
|
|
|
@ -16,7 +16,7 @@ failure_derive = "~0.1"
|
||||||
http = "~0.2"
|
http = "~0.2"
|
||||||
hyper = "~0.14"
|
hyper = "~0.14"
|
||||||
serde_json = "~1.0"
|
serde_json = "~1.0"
|
||||||
uuid = { version = "~1.0" }
|
uuid = { version = "~1" }
|
||||||
|
|
||||||
[dependencies.rusqlite]
|
[dependencies.rusqlite]
|
||||||
version = "~0.29"
|
version = "~0.29"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
name = "mentat_tolstoy"
|
name = "mentat_tolstoy"
|
||||||
version = "0.0.2"
|
version = "0.0.2"
|
||||||
workspace = ".."
|
workspace = ".."
|
||||||
|
@ -22,7 +22,7 @@ serde_json = "~1.0"
|
||||||
serde_cbor = "~0.11"
|
serde_cbor = "~0.11"
|
||||||
serde_derive = "~1.0"
|
serde_derive = "~1.0"
|
||||||
lazy_static = "~1.4"
|
lazy_static = "~1.4"
|
||||||
uuid = { version = "~1.0", features = ["v4", "serde"] }
|
uuid = { version = "~1", features = ["v4", "serde"] }
|
||||||
|
|
||||||
[dependencies.rusqlite]
|
[dependencies.rusqlite]
|
||||||
version = "~0.29"
|
version = "~0.29"
|
||||||
|
|
Loading…
Reference in a new issue