diff --git a/Makefile b/Makefile
index b98e45d..33ceaf5 100644
--- a/Makefile
+++ b/Makefile
@@ -22,4 +22,3 @@ test-all:
(cd implementations/javascript; npm test)
(cd implementations/python; make test)
(cd implementations/racket/preserves; make testonly)
- (cd implementations/rust; cargo test)
diff --git a/README.md b/README.md
index 2fd1875..f0d45d9 100644
--- a/README.md
+++ b/README.md
@@ -38,14 +38,14 @@ automatic, perfect-fidelity conversion between syntaxes.
#### Implementations of the data model, plus Preserves textual and binary transfer syntax
-| Language[^pre-alpha-implementations] | Code | Package | Docs |
-|-----------------------|------------------------------------------------------------------------------|--------------------------------------------------------------------------------|-------------------------------------------|
-| Nim | [git.syndicate-lang.org](https://git.syndicate-lang.org/ehmry/preserves-nim) | | |
-| Python | [preserves.dev]({{page.projecttree}}/implementations/python/) | [`pip install preserves`](https://pypi.org/project/preserves/) | [docs](python/latest/) |
-| Racket | [preserves.dev]({{page.projecttree}}/implementations/racket/preserves/) | [`raco pkg install preserves`](https://pkgs.racket-lang.org/package/preserves) | |
-| Rust | [preserves.dev]({{page.projecttree}}/implementations/rust/) | [`cargo add preserves`](https://crates.io/crates/preserves) | [docs](https://docs.rs/preserves/latest/) |
-| Squeak Smalltalk | [SqueakSource](https://squeaksource.com/Preserves.html) | `Installer ss project: 'Preserves';`
`Â Â install: 'Preserves'` | |
-| TypeScript/JavaScript | [preserves.dev]({{page.projecttree}}/implementations/javascript/) | [`yarn add @preserves/core`](https://www.npmjs.com/package/@preserves/core) | |
+| Language[^pre-alpha-implementations] | Code | Package | Docs |
+|--------------------------------------|------------------------------------------------------------------------------|--------------------------------------------------------------------------------|-------------------------------------------|
+| Nim | [git.syndicate-lang.org](https://git.syndicate-lang.org/ehmry/preserves-nim) | | |
+| Python | [preserves.dev]({{page.projecttree}}/implementations/python/) | [`pip install preserves`](https://pypi.org/project/preserves/) | [docs](python/latest/) |
+| Racket | [preserves.dev]({{page.projecttree}}/implementations/racket/preserves/) | [`raco pkg install preserves`](https://pkgs.racket-lang.org/package/preserves) | |
+| Rust | [preserves.dev](https://gitlab.com/preserves/preserves-rs/) | [`cargo add preserves`](https://crates.io/crates/preserves) | [docs](https://docs.rs/preserves/latest/) |
+| Squeak Smalltalk | [SqueakSource](https://squeaksource.com/Preserves.html) | `Installer ss project: 'Preserves';`
`Â Â install: 'Preserves'` | |
+| TypeScript/JavaScript | [preserves.dev]({{page.projecttree}}/implementations/javascript/) | [`yarn add @preserves/core`](https://www.npmjs.com/package/@preserves/core) | |
[^pre-alpha-implementations]: Pre-alpha implementations also exist for
[C]({{page.projecttree}}/implementations/c/) and
diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit
index 1da8323..4037e41 100755
--- a/git-hooks/pre-commit
+++ b/git-hooks/pre-commit
@@ -31,7 +31,6 @@ fi
# Ensure that various copies of schema.prs, schema.bin, path.bin,
# samples.pr and samples.bin are in fact identical.
${COMMAND} path/path.bin implementations/python/preserves/path.prb
-${COMMAND} path/path.bin implementations/rust/preserves-path/path.bin
${COMMAND} schema/schema.bin implementations/python/preserves/schema.prb
${COMMAND} schema/schema.prs implementations/racket/preserves/preserves-schema/schema.prs
@@ -40,11 +39,4 @@ ${COMMAND} tests/samples.bin implementations/python/tests/samples.bin
${COMMAND} tests/samples.pr implementations/python/tests/samples.pr
${COMMAND} tests/samples.pr implementations/racket/preserves/preserves/tests/samples.pr
-${COMMAND} _includes/what-is-preserves.md implementations/rust/preserves/doc/what-is-preserves.md
-${COMMAND} _includes/cheatsheet-binary-plaintext.md implementations/rust/preserves/doc/cheatsheet-binary-plaintext.md
-${COMMAND} _includes/cheatsheet-text-plaintext.md implementations/rust/preserves/doc/cheatsheet-text-plaintext.md
-${COMMAND} _includes/value-grammar.md implementations/rust/preserves/doc/value-grammar.md
-
-${COMMAND} _includes/what-is-preserves-schema.md implementations/rust/preserves-schema/doc/what-is-preserves-schema.md
-
[ -z "$failed" ]
diff --git a/implementations/README.md b/implementations/README.md
index c0d0399..98908c9 100644
--- a/implementations/README.md
+++ b/implementations/README.md
@@ -13,9 +13,9 @@ Here you may find:
- [racket](racket/), an implementation for Racket 7.x and newer
(though older Rackets may also work with it).
- - [rust](rust/), an implementation for Rust that interoperates with
- serde.
-
Other implementations are also available:
+ - [Preserves for Rust](https://gitlab.com/preserves/preserves-rs/), an implementation for Rust
+ that interoperates with serde.
+
- [Preserves for Squeak Smalltalk](https://squeaksource.com/Preserves.html)
diff --git a/implementations/rust/.gitignore b/implementations/rust/.gitignore
deleted file mode 100644
index 7c6e654..0000000
--- a/implementations/rust/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Cargo.lock
-scratch/
-target/
diff --git a/implementations/rust/Cargo.toml b/implementations/rust/Cargo.toml
deleted file mode 100644
index 60af6ee..0000000
--- a/implementations/rust/Cargo.toml
+++ /dev/null
@@ -1,15 +0,0 @@
-[workspace]
-exclude = [
- "examples/schema-no-build",
- ]
-
-members = [
- "preserves",
- "preserves-path",
- "preserves-schema",
- "preserves-schema-macros",
- "preserves-tools",
- ]
-
-[profile.bench]
-debug = true
diff --git a/implementations/rust/Makefile b/implementations/rust/Makefile
deleted file mode 100644
index 4432efb..0000000
--- a/implementations/rust/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# Use cargo release to manage publication and versions etc.
-#
-# cargo install cargo-release
-
-all:
- cargo build --all-targets
-
-doc:
- cargo doc --workspace
-
-x86_64-binary: x86_64-binary-release
-
-x86_64-binary-release:
- cross build --target=x86_64-unknown-linux-musl --release --all-targets
-
-armv7-binary: armv7-binary-release
-
-armv7-binary-release:
- cross build --target=armv7-unknown-linux-musleabihf --release --all-targets
-
-aarch64-binary: aarch64-binary-release
-
-aarch64-binary-release:
- cross build --target=aarch64-unknown-linux-musl --release --all-targets
-
-test:
- cargo test
-
-test-all:
- cargo test --all-targets
-
-ws-bump:
- cargo workspaces version \
- --no-global-tag \
- --individual-tag-prefix 'rust-%n@' \
- --allow-branch 'main' \
- --ignore-changes '../*'
-
-ws-publish:
- cargo workspaces publish \
- --from-git
diff --git a/implementations/rust/README.md b/implementations/rust/README.md
new file mode 100644
index 0000000..d375542
--- /dev/null
+++ b/implementations/rust/README.md
@@ -0,0 +1,13 @@
+# Split out to separate repository
+
+The Rust implementation of Preserves has been split out into a separate git repository,
+.
+
+The final released versions that were here were
+
+ - `preserves` v4.992.2,
+ - `preserves-schema` v5.992.0,
+ - `preserves-tools` v4.992.2, and
+ - `preserves-path` v5.992.0.
+
+Subsequent releases live in the other repository.
diff --git a/implementations/rust/examples/schema-no-build/Cargo.toml b/implementations/rust/examples/schema-no-build/Cargo.toml
deleted file mode 100644
index 68d7a70..0000000
--- a/implementations/rust/examples/schema-no-build/Cargo.toml
+++ /dev/null
@@ -1,10 +0,0 @@
-[package]
-name = "schema-no-build"
-version = "0.1.0"
-edition = "2021"
-
-[dependencies]
-lazy_static = "1"
-preserves = { path = "../../preserves" }
-preserves-schema = { path = "../../preserves-schema" }
-preserves-schema-macros = { path = "../../preserves-schema-macros" }
diff --git a/implementations/rust/examples/schema-no-build/src/main.rs b/implementations/rust/examples/schema-no-build/src/main.rs
deleted file mode 100644
index a12f8e7..0000000
--- a/implementations/rust/examples/schema-no-build/src/main.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-use preserves::value::IOValue;
-use preserves_schema_macros::compile_preserves_schemas;
-
-compile_preserves_schemas!(
- crate::schemas,
- load("/../../../../path/path.bin"),
- external_module(EntityRef = crate::demo_entity_ref),
-);
-
-pub mod demo_entity_ref {
- use preserves::value::IOValue;
- pub type Cap = IOValue;
-}
-
-preserves_schema::define_language!(language(): Language {
- demo: crate::schemas::Language,
-});
-
-fn main() {
- use crate::schemas::path::*;
- use preserves::value::NestedValue;
- use preserves_schema::support::Unparse;
- println!("Hello, world! {:?}", (Filter::Compare {
- op: Box::new(Comparison::Eq),
- literal: IOValue::new(123),
- }).unparse(language()));
-}
diff --git a/implementations/rust/preserves-path/Cargo.toml b/implementations/rust/preserves-path/Cargo.toml
deleted file mode 100644
index 52b2862..0000000
--- a/implementations/rust/preserves-path/Cargo.toml
+++ /dev/null
@@ -1,23 +0,0 @@
-[package]
-name = "preserves-path"
-version = "5.993.0"
-authors = ["Tony Garnock-Jones "]
-edition = "2018"
-description = "Implementation of preserves-path, a query language for Preserves documents."
-homepage = "https://preserves.dev/"
-repository = "https://gitlab.com/preserves/preserves"
-license = "Apache-2.0"
-
-[build-dependencies]
-preserves-schema = { path = "../preserves-schema", version = "5.993.0"}
-
-[dependencies]
-preserves = { path = "../preserves", version = "4.993.0"}
-preserves-schema = { path = "../preserves-schema", version = "5.993.0"}
-
-num = "0.4"
-regex = "1.5"
-thiserror = "1.0"
-
-[package.metadata.workspaces]
-independent = true
diff --git a/implementations/rust/preserves-path/build.rs b/implementations/rust/preserves-path/build.rs
deleted file mode 100644
index 7db9063..0000000
--- a/implementations/rust/preserves-path/build.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-use preserves_schema::compiler::*;
-
-use std::io::Error;
-use std::path::PathBuf;
-
-fn main() -> Result<(), Error> {
- let buildroot = PathBuf::from(std::env::var_os("OUT_DIR").unwrap());
-
- let mut gen_dir = buildroot.clone();
- gen_dir.push("src/schemas");
-
- let mut c = CompilerConfig::new("crate::schemas".to_owned());
-
- let inputs = expand_inputs(&vec!["path.bin".to_owned()])?;
- c.load_schemas_and_bundles(&inputs, &vec![])?;
-
- compile(&c, &mut CodeCollector::files(gen_dir))
-}
diff --git a/implementations/rust/preserves-path/path.bin b/implementations/rust/preserves-path/path.bin
deleted file mode 100644
index d1c1b1a..0000000
--- a/implementations/rust/preserves-path/path.bin
+++ /dev/null
@@ -1,7 +0,0 @@
-´³schema·³version°³definitions·³Axis´³orµµ±values´³rec´³lit³values„´³tupleµ„„„„µ±descendants´³rec´³lit³descendants„´³tupleµ„„„„µ±at´³rec´³lit³at„´³tupleµ´³named³key³any„„„„„µ±label´³rec´³lit³label„´³tupleµ„„„„µ±keys´³rec´³lit³keys„´³tupleµ„„„„µ±length´³rec´³lit³length„´³tupleµ„„„„µ±annotations´³rec´³lit³annotations„´³tupleµ„„„„µ±embedded´³rec´³lit³embedded„´³tupleµ„„„„µ±parse´³rec´³lit³parse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„µ±unparse´³rec´³lit³unparse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„„„³Step´³orµµ±Axis´³refµ„³Axis„„µ±Filter´³refµ„³Filter„„µ±Function´³refµ„³Function„„„„³Filter´³orµµ±nop´³rec´³lit³nop„´³tupleµ„„„„µ±compare´³rec´³lit³compare„´³tupleµ´³named³op´³refµ„³
-Comparison„„´³named³literal³any„„„„„µ±regex´³rec´³lit³regex„´³tupleµ´³named³regex´³atom³String„„„„„„µ±test´³rec´³lit³test„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±real´³rec´³lit³real„´³tupleµ„„„„µ±int´³rec´³lit³int„´³tupleµ„„„„µ±kind´³rec´³lit³kind„´³tupleµ´³named³kind´³refµ„³ ValueKind„„„„„„„„³Function´³rec´³lit³count„´³tupleµ´³named³selector´³refµ„³Selector„„„„„³Selector´³seqof´³refµ„³Step„„³ Predicate´³orµµ±Selector´³refµ„³Selector„„µ±not´³rec´³lit³not„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±or´³rec´³lit³or„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„µ±and´³rec´³lit³and„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„„„³ ValueKind´³orµµ±Boolean´³lit³Boolean„„µ±Double´³lit³Double„„µ±
SignedInteger´³lit³
SignedInteger„„µ±String´³lit³String„„µ±
-ByteString´³lit³
-ByteString„„µ±Symbol´³lit³Symbol„„µ±Record´³lit³Record„„µ±Sequence´³lit³Sequence„„µ±Set´³lit³Set„„µ±
-Dictionary´³lit³
-Dictionary„„µ±Embedded´³lit³Embedded„„„„³
-Comparison´³orµµ±eq´³lit³eq„„µ±ne´³lit³ne„„µ±lt´³lit³lt„„µ±ge´³lit³ge„„µ±gt´³lit³gt„„µ±le´³lit³le„„„„„³embeddedType€„„
\ No newline at end of file
diff --git a/implementations/rust/preserves-path/src/context.rs b/implementations/rust/preserves-path/src/context.rs
deleted file mode 100644
index 8afad8f..0000000
--- a/implementations/rust/preserves-path/src/context.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-use preserves::value::IOValue;
-
-use preserves_schema::compiler::load_schema_or_bundle;
-use preserves_schema::gen::schema::Definition;
-
-use std::io;
-
-#[derive(Default)]
-pub struct Env(pub preserves_schema::support::interpret::Env);
-
-pub struct Context<'a> {
- pub env: &'a Env,
- path: Vec,
-}
-
-impl<'a> Context<'a> {
- pub fn new(env: &'a Env) -> Self {
- Context {
- env,
- path: Vec::new(),
- }
- }
-
- pub fn with_path_step R>(&mut self, v: &IOValue, f: F) -> R {
- self.path.push(v.clone());
- let result = f(self);
- self.path.pop();
- result
- }
-}
-
-impl Env {
- pub fn new() -> Self {
- Default::default()
- }
-
- pub fn load_bundle(&mut self, filename: &std::path::PathBuf) -> io::Result {
- load_schema_or_bundle(&mut self.0, filename)
- }
-
- pub fn lookup_definition(
- &self,
- module: &Vec,
- name: &str,
- ) -> Option<&Definition> {
- self.0.get(module).and_then(|s| s.definitions.0.get(name))
- }
-
- pub fn to_context(&self) -> Context {
- Context::new(self)
- }
-}
diff --git a/implementations/rust/preserves-path/src/error.rs b/implementations/rust/preserves-path/src/error.rs
deleted file mode 100644
index 7e0afc5..0000000
--- a/implementations/rust/preserves-path/src/error.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-use std::io;
-
-use thiserror::Error;
-
-#[derive(Error, Debug)]
-pub enum CompilationError {
- #[error(transparent)]
- IoError(#[from] io::Error),
- #[error("Cannot mix binary operators")]
- MixedOperators,
- #[error("Invalid step")]
- InvalidStep,
- #[error("Undefined schema definition name: {0}")]
- UndefinedSchemaDefinitionName(String),
- #[error(transparent)]
- RegexError(#[from] regex::Error),
-}
diff --git a/implementations/rust/preserves-path/src/lib.rs b/implementations/rust/preserves-path/src/lib.rs
deleted file mode 100644
index 43e705c..0000000
--- a/implementations/rust/preserves-path/src/lib.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-pub mod context;
-pub mod error;
-pub mod parse;
-pub mod predicate;
-
-pub mod schemas {
- include!(concat!(env!("OUT_DIR"), "/src/schemas/mod.rs"));
-}
-
-pub mod step;
-
-pub use context::Context;
-pub use context::Env;
-
-pub use error::CompilationError;
-
-pub use parse::parse_predicate;
-pub use parse::parse_selector;
-
-pub use schemas::path::Predicate;
-pub use schemas::path::Selector;
-pub use schemas::path::Step;
-
-pub use step::Node;
diff --git a/implementations/rust/preserves-path/src/parse.rs b/implementations/rust/preserves-path/src/parse.rs
deleted file mode 100644
index 2741524..0000000
--- a/implementations/rust/preserves-path/src/parse.rs
+++ /dev/null
@@ -1,322 +0,0 @@
-use crate::context::Env;
-use crate::schemas::path;
-use crate::step::Node;
-use crate::CompilationError;
-
-use preserves::value::BinarySource;
-use preserves::value::BytesBinarySource;
-use preserves::value::IOValue;
-use preserves::value::NestedValue;
-use preserves::value::Reader;
-
-use std::iter::Iterator;
-
-#[derive(Debug)]
-enum Binop {
- Union,
- Intersection,
-}
-
-fn split_values_by_symbol<'a>(tokens: &'a [IOValue], separator: &str) -> Vec<&'a [IOValue]> {
- tokens
- .split(|t| matches!(t.value().as_symbol(), Some(s) if s == separator))
- .collect()
-}
-
-fn split_binop(tokens: &[IOValue]) -> Result<(Vec<&[IOValue]>, Option), CompilationError> {
- let union_pieces = split_values_by_symbol(&tokens, "+");
- let intersection_pieces = split_values_by_symbol(&tokens, "&");
- match (union_pieces.len(), intersection_pieces.len()) {
- (1, 1) => Ok((union_pieces, None)),
- (_, 1) => Ok((union_pieces, Some(Binop::Union))),
- (1, _) => Ok((intersection_pieces, Some(Binop::Intersection))),
- _ => Err(CompilationError::MixedOperators),
- }
-}
-
-pub fn parse_selector(env: &Env, tokens: &[IOValue]) -> Result {
- let mut steps = Vec::new();
- let mut tokens = tokens;
- while let Some((s, remaining)) = parse_step(env, tokens)? {
- steps.push(s);
- tokens = remaining;
- }
- Ok(path::Selector(steps))
-}
-
-pub fn parse_predicate(env: &Env, tokens: &[IOValue]) -> Result {
- let (pieces, binop) = split_binop(tokens)?;
- match binop {
- None => parse_non_binop(env, &pieces[0]),
- Some(o) => {
- let preds = pieces
- .into_iter()
- .map(|ts| parse_non_binop(env, &ts))
- .collect::>()?;
- Ok(match o {
- Binop::Union => path::Predicate::Or { preds },
- Binop::Intersection => path::Predicate::And { preds },
- })
- }
- }
-}
-
-fn parse_non_binop(env: &Env, tokens: &[IOValue]) -> Result {
- if !tokens.is_empty() {
- let t = tokens[0].value();
-
- if let Some("!") = t.as_symbol().map(|s| s.as_str()) {
- return Ok(path::Predicate::Not {
- pred: Box::new(parse_non_binop(env, &tokens[1..])?),
- });
- }
- }
-
- Ok(path::Predicate::Selector(Box::new(parse_selector(
- env, tokens,
- )?)))
-}
-
-fn parse_schema_definition_name(
- env: &Env,
- token: &IOValue,
-) -> Result<(Vec, String), CompilationError> {
- let defpath = token
- .value()
- .to_symbol()
- .map_err(|_| CompilationError::InvalidStep)?;
- let mut module: Vec = defpath.split('.').map(|s| s.to_string()).collect();
- let name = module
- .pop()
- .expect("at least one element in the Schema name");
- match env.lookup_definition(&module, &name) {
- Some(_) => Ok((module, name)),
- None => Err(CompilationError::UndefinedSchemaDefinitionName(format!(
- "{:?}",
- token
- ))),
- }
-}
-
-fn parse_step<'a>(
- env: &Env,
- tokens: &'a [IOValue],
-) -> Result