Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
c1b9561
Introduce mxl-sys crate
pac-work Jun 20, 2025
7b46ad2
Add first skeleton for "middle layer" binding
pac-work Jun 20, 2025
4ae3acc
vscode: set root for rust analyzer
pedro-alves-ferreira Jun 22, 2025
fbb907d
modules: create a separate module for errors
pedro-alves-ferreira Jun 22, 2025
e595c20
modules: create a separate module for the ffi api
pedro-alves-ferreira Jun 22, 2025
09578cc
modules: create a separate module for the instance
pedro-alves-ferreira Jun 22, 2025
56893ad
modules: create a separate module for flow information
pedro-alves-ferreira Jun 22, 2025
4f3d529
modules: create a separate module for the flow reader
pedro-alves-ferreira Jun 22, 2025
9cb64fe
instance: don't use unwrap.
pedro-alves-ferreira Jun 22, 2025
75fca90
instance: don't expose a destroy method as that breaks the invariants
pedro-alves-ferreira Jun 22, 2025
68bef75
build: add a build.rs file to expose the mxl build path
pedro-alves-ferreira Jun 22, 2025
7cb3917
build: use mxl headers directly
pedro-alves-ferreira Jun 22, 2025
4e33af4
examples: add basic example
pedro-alves-ferreira Jun 22, 2025
65d1822
reader: decouple lifetime from instance
pedro-alves-ferreira Jun 24, 2025
f5a4743
instance: add a destroy function for testing
pedro-alves-ferreira Jun 24, 2025
c1d5550
reader: consume self on destroy so that the invariants are not broken
pedro-alves-ferreira Jun 24, 2025
88fb975
grain data: don't allocate and copy payload & user data
pedro-alves-ferreira Jun 22, 2025
cd07bae
error: preserve the error code for unknown errors
pedro-alves-ferreira Jun 23, 2025
03a7505
layout: rename rust-bindings to rust
pedro-alves-ferreira Jun 24, 2025
4a604cc
grain data: add OwnedGrainData and conversion from GrainData
pedro-alves-ferreira Jun 24, 2025
666a138
Reflect function name changes in MXL
pac-work Jul 11, 2025
a7cd8cb
Add basic discrete flow writer Rust wrapper
pac-work Jul 9, 2025
017d0b6
Fix double free on explicit instance destruction in test
pac-work Jul 9, 2025
9ad5676
Rename GrainWriter to GrainWriteAccess
pac-work Jul 10, 2025
69a2bd5
Change MxlFlowWriter into a factory class for more specific writers
pac-work Jul 10, 2025
b32eb78
Add basic continuous flow writer Rust wrapper
pac-work Jul 11, 2025
5b8697d
Change MxlFlowReader into a factory class for more specific readers
pac-work Jul 17, 2025
1efbf67
Add basic continuous flow reader Rust wrapper
pac-work Jul 18, 2025
66e2000
Convert instance destroy into safe function
pac-work Jul 18, 2025
50244ab
Allow referencing rust crates without the need to build MXL
pac-work Jul 22, 2025
c2fd34f
Allow instance cloning
pac-work Jul 31, 2025
bffed91
Implement Send for readers and writers
pac-work Jul 31, 2025
703df87
refactor: re-organise module structure
cwtchan Jul 23, 2025
f8aa668
Fix warnings reported by the current Rust compiler
pac-work Aug 18, 2025
fbe4482
Fix warnings reported by the current Clippy
pac-work Aug 18, 2025
242d86b
feat: first pass at github actions for rust bindings
cwtchan Aug 1, 2025
3421135
feat: add build options to build neither tests nor tools
cwtchan Aug 13, 2025
d066d56
feat: ignore generated mxl version header file
cwtchan Aug 13, 2025
7b6207c
feat: add options to not build tools nor tests
cwtchan Aug 14, 2025
c90a5d1
feat: use `cmake` in `build.rs` for `mxl-sys`
cwtchan Aug 14, 2025
27cacdf
refactor: move code for compiling `mxl` with cmake
cwtchan Aug 14, 2025
71fd4c2
fix: update `build.rs` to build into build dir
cwtchan Aug 15, 2025
afa0df3
fix: supply build_dir correctly as path
cwtchan Aug 15, 2025
b97d83e
fix: building the shared library for the rust bindings
cwtchan Aug 15, 2025
09e0785
devcontainer: add rust tooling to container
pedro-alves-ferreira Sep 25, 2025
d41dfe0
cmake: add an option to disable building the docs
pedro-alves-ferreira Sep 25, 2025
7a566ec
build.rs: use CMake presets
pedro-alves-ferreira Sep 25, 2025
f016b24
build.rs: simplify binding generation
pedro-alves-ferreira Sep 25, 2025
35131fe
rust: update to 1.90.0
pedro-alves-ferreira Sep 25, 2025
4d88a77
rust: correct typo in get_mxl_so_path
pedro-alves-ferreira Sep 25, 2025
d28e967
doc: fix warnings in doc generation for bindings
pedro-alves-ferreira Jun 24, 2025
3eb999d
devcontainer: add rust analyzer plugin
pedro-alves-ferreira Sep 25, 2025
483f6df
reuse: add licensing information to Rust files
pedro-alves-ferreira Aug 12, 2025
cf998ad
rust test: add a nextest config file
pedro-alves-ferreira Aug 12, 2025
f78f26c
Make Rust bindings compatiple with MXL 0.7.x
pac-work Aug 25, 2025
1d1b021
Add mxlGetFlowDef into the Rust bindings
pac-work Aug 28, 2025
fde4dc6
Fix mxl-not-built feature
pac-work Sep 26, 2025
c82d779
Use std::fs::read_to_string instead of custom function
pac-work Sep 26, 2025
72838b7
dev container: remove duplicate entry
pedro-alves-ferreira Oct 1, 2025
218845b
dev container: set the root path for rust analyzer
pedro-alves-ferreira Oct 1, 2025
5698256
rust: fix clippy lints
pedro-alves-ferreira Oct 1, 2025
380336d
rust: add license to nextest config
pedro-alves-ferreira Oct 1, 2025
d351b77
rust: upgrade tracing-subscriber
pedro-alves-ferreira Oct 1, 2025
fd268c6
rust: add version to Cargo.toml
pedro-alves-ferreira Oct 1, 2025
28d648f
rust: add a config file for cargo deny
pedro-alves-ferreira Oct 1, 2025
9b5cf08
ci: create the rust target directory
pedro-alves-ferreira Oct 1, 2025
24c2e9c
ci: add rust tasks
pedro-alves-ferreira Oct 1, 2025
752b6c1
ci: delete the original rust workflow
pedro-alves-ferreira Oct 1, 2025
b053dfb
rust: allow reusing a loaded api
pedro-alves-ferreira Oct 1, 2025
bc6e3dc
rust: add non-blocking version of get grain
pedro-alves-ferreira Oct 1, 2025
ab8953b
rust: rename MxlFlowReader to FlowReader
pedro-alves-ferreira Oct 2, 2025
01a7bc3
rust: rename MxlFlowWriter to FlowWriter
pedro-alves-ferreira Oct 2, 2025
6e31ff6
rust: remove mxl prefix from api function names
pedro-alves-ferreira Oct 2, 2025
403ac4d
Only push docker images from pipeline if not building a fork
pac-work Oct 14, 2025
87611b1
Make Rust bindings compatiple with MXL 0.8.x
pac-work Oct 16, 2025
8ad02c9
Do not do debug build in Rust pipelines
pac-work Oct 20, 2025
c56f54b
Make Rust bindings compatiple with the latest MXL
pac-work Oct 31, 2025
af92fa0
Merge branch 'dmf-mxl:main' into rust-bindings
pac-work Nov 7, 2025
7a68ce3
Merge branch 'main' into rust-bindings
pedro-alves-ferreira Nov 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,5 @@ RUN git clone https://github.com/microsoft/vcpkg \

ENV VCPKG_ROOT="/home/${USERNAME}/vcpkg"

RUN rustup default 1.88.0
COPY ./scripts/ /tmp/scripts/
RUN /tmp/scripts/common/rust/install-rust.sh
3 changes: 2 additions & 1 deletion .devcontainer/Dockerfile.almalinux
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,5 @@ RUN git clone https://github.com/microsoft/vcpkg \

ENV VCPKG_ROOT=/home/$USERNAME/vcpkg

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.88.0
COPY ./scripts/ /tmp/scripts/
RUN /tmp/scripts/common/rust/install-rust.sh
3 changes: 2 additions & 1 deletion .devcontainer/Dockerfile.amazonlinux
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,5 @@ RUN git clone https://github.com/microsoft/vcpkg \

ENV VCPKG_ROOT=/home/$USERNAME/vcpkg

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.88.0
COPY ./scripts/ /tmp/scripts/
RUN /tmp/scripts/common/rust/install-rust.sh
3 changes: 2 additions & 1 deletion .devcontainer/Dockerfile.debiantrixie
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,5 @@ RUN git clone https://github.com/microsoft/vcpkg \

ENV VCPKG_ROOT="/home/${USERNAME}/vcpkg"

RUN rustup default 1.88.0
COPY ./scripts/ /tmp/scripts/
RUN /tmp/scripts/common/rust/install-rust.sh
3 changes: 2 additions & 1 deletion .devcontainer/Dockerfile.ubuntu-legacy
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,5 @@ ENV VCPKG_ROOT=/home/$USERNAME/vcpkg
# Make the selected clang version the default alternative
RUN sudo /tmp/scripts/debian/register-clang-version.sh ${CLANG_VERSION} 100

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.88.0
COPY ./scripts/ /tmp/scripts/
RUN /tmp/scripts/common/rust/install-rust.sh
10 changes: 7 additions & 3 deletions .devcontainer/almalinux/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"matepek.vscode-catch2-test-adapter",
"llvm-vs-code-extensions.vscode-clangd",
"xaver.clang-format",
"bierner.markdown-mermaid"
"bierner.markdown-mermaid",
"rust-lang.rust-analyzer"
],
"settings": {
"C_Cpp.intelliSenseEngine": "disabled",
Expand All @@ -37,7 +38,10 @@
"editor.formatOnSave": true,
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
}
},
"rust-analyzer.linkedProjects": [
"${workspaceFolder}/rust/Cargo.toml"
]
}
}
},
Expand All @@ -50,4 +54,4 @@
"gpu": "optional"
},
"remoteUser": "devcontainer"
}
}
10 changes: 7 additions & 3 deletions .devcontainer/amazonlinux/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"matepek.vscode-catch2-test-adapter",
"llvm-vs-code-extensions.vscode-clangd",
"xaver.clang-format",
"bierner.markdown-mermaid"
"bierner.markdown-mermaid",
"rust-lang.rust-analyzer"
],
"settings": {
"C_Cpp.intelliSenseEngine": "disabled",
Expand All @@ -41,7 +42,10 @@
"editor.formatOnSave": true,
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
}
},
"rust-analyzer.linkedProjects": [
"${workspaceFolder}/rust/Cargo.toml"
]
}
}
},
Expand All @@ -51,4 +55,4 @@
"DISPLAY": "${localEnv:DISPLAY}"
},
"remoteUser": "devcontainer"
}
}
10 changes: 7 additions & 3 deletions .devcontainer/debiantrixie/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"matepek.vscode-catch2-test-adapter",
"llvm-vs-code-extensions.vscode-clangd",
"xaver.clang-format",
"bierner.markdown-mermaid"
"bierner.markdown-mermaid",
"rust-lang.rust-analyzer"
],
"settings": {
"C_Cpp.intelliSenseEngine": "disabled",
Expand All @@ -37,7 +38,10 @@
"editor.formatOnSave": true,
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
}
},
"rust-analyzer.linkedProjects": [
"${workspaceFolder}/rust/Cargo.toml"
]
}
}
},
Expand All @@ -50,4 +54,4 @@
"gpu": "optional"
},
"remoteUser": "devcontainer"
}
}
28 changes: 28 additions & 0 deletions .devcontainer/scripts/common/rust/install-rust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
# SPDX-License-Identifier: Apache-2.0

set -eu

RUST_VERSION=1.90.0

if command -v rustup > /dev/null 2>&1; then
rustup default $RUST_VERSION
else
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=$RUST_VERSION
. "$HOME/.cargo/env"
fi

# Install cargo binstall
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash

cargo binstall cargo-audit --locked
cargo binstall cargo-outdated --locked

# udeps requires the nightly compiler, so using machete (at least for now)
# cargo binstall cargo-udeps --locked
cargo binstall cargo-machete --locked

cargo binstall cargo-deny --locked
cargo binstall cargo-nextest --locked
10 changes: 7 additions & 3 deletions .devcontainer/ubuntu20/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"matepek.vscode-catch2-test-adapter",
"llvm-vs-code-extensions.vscode-clangd",
"xaver.clang-format",
"bierner.markdown-mermaid"
"bierner.markdown-mermaid",
"rust-lang.rust-analyzer"
],
"settings": {
"C_Cpp.intelliSenseEngine": "disabled",
Expand All @@ -39,7 +40,10 @@
"editor.formatOnSave": true,
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
}
},
"rust-analyzer.linkedProjects": [
"${workspaceFolder}/rust/Cargo.toml"
]
}
}
},
Expand All @@ -52,4 +56,4 @@
"gpu": "optional"
},
"remoteUser": "devcontainer"
}
}
10 changes: 7 additions & 3 deletions .devcontainer/ubuntu22/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"matepek.vscode-catch2-test-adapter",
"llvm-vs-code-extensions.vscode-clangd",
"xaver.clang-format",
"bierner.markdown-mermaid"
"bierner.markdown-mermaid",
"rust-lang.rust-analyzer"
],
"settings": {
"C_Cpp.intelliSenseEngine": "disabled",
Expand All @@ -39,7 +40,10 @@
"editor.formatOnSave": true,
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
}
},
"rust-analyzer.linkedProjects": [
"${workspaceFolder}/rust/Cargo.toml"
]
}
}
},
Expand All @@ -52,4 +56,4 @@
"gpu": "optional"
},
"remoteUser": "devcontainer"
}
}
10 changes: 7 additions & 3 deletions .devcontainer/ubuntu24/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"matepek.vscode-catch2-test-adapter",
"llvm-vs-code-extensions.vscode-clangd",
"xaver.clang-format",
"bierner.markdown-mermaid"
"bierner.markdown-mermaid",
"rust-lang.rust-analyzer"
],
"settings": {
"C_Cpp.intelliSenseEngine": "disabled",
Expand All @@ -39,7 +40,10 @@
"editor.formatOnSave": true,
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
}
},
"rust-analyzer.linkedProjects": [
"${workspaceFolder}/rust/Cargo.toml"
]
}
}
},
Expand All @@ -52,4 +56,4 @@
"gpu": "optional"
},
"remoteUser": "devcontainer"
}
}
10 changes: 7 additions & 3 deletions .devcontainer/ubuntu25/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"matepek.vscode-catch2-test-adapter",
"llvm-vs-code-extensions.vscode-clangd",
"xaver.clang-format",
"bierner.markdown-mermaid"
"bierner.markdown-mermaid",
"rust-lang.rust-analyzer"
],
"settings": {
"C_Cpp.intelliSenseEngine": "disabled",
Expand All @@ -39,7 +40,10 @@
"editor.formatOnSave": true,
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
}
},
"rust-analyzer.linkedProjects": [
"${workspaceFolder}/rust/Cargo.toml"
]
}
}
},
Expand All @@ -52,4 +56,4 @@
"gpu": "optional"
},
"remoteUser": "devcontainer"
}
}
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ jobs:
mkdir -p ${{ github.workspace }}/install
chmod 777 ${{ github.workspace }}/install
chmod g+s ${{ github.workspace }}/install
mkdir -p ${{ github.workspace }}/rust/target
chmod 777 ${{ github.workspace }}/rust/target
chmod g+s ${{ github.workspace }}/rust/target

- name: Build Docker image
if: steps.check-image.outputs.exists == 'false'
Expand Down Expand Up @@ -173,6 +176,52 @@ jobs:
ctest --output-junit test-results.xml
"

- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.toml') }}
restore-keys: ${{ runner.os }}-cargo-lint-

- name: Check the Rust bindings
env:
RUSTFLAGS: "-Dwarnings"
run: |
docker run --mount src=${{ github.workspace }},target=/workspace/mxl,type=bind \
-i mxl_build_container_with_source \
bash -c "
cd /workspace/mxl/rust && \
cargo fmt -- --check && \
cargo clippy --all-targets --all-features --locked -- -D warnings && \
cargo audit && \
cargo outdated && \
cargo machete && \
cargo deny check all
"

- name: Build Rust bindings
run: |
docker run --mount src=${{ github.workspace }},target=/workspace/mxl,type=bind \
-i mxl_build_container_with_source \
bash -c "
cd /workspace/mxl/rust && \
cargo build --release --all-targets --locked
"

- name: Test the Rust bindings
run: |
docker run --mount src=${{ github.workspace }},target=/workspace/mxl,type=bind \
-i mxl_build_container_with_source \
bash -c "
cd /workspace/mxl/rust && \
cargo nextest run --release --locked
"

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project https://github.com/dmf-mxl/mxl/contributors.md
// SPDX-License-Identifier: Apache-2.0
{
"rust-analyzer.linkedProjects": [
"rust/Cargo.toml"
],
"files.associations": {
"array": "cpp",
"atomic": "cpp",
Expand Down Expand Up @@ -71,4 +74,4 @@
"typeinfo": "cpp",
"variant": "cpp"
}
}
}
Loading