Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4db05c0
Introduce mxl-sys crate
pac-work Jun 20, 2025
14a702d
Add first skeleton for "middle layer" binding
pac-work Jun 20, 2025
24d2596
vscode: set root for rust analyzer
pedro-alves-ferreira Jun 22, 2025
9929f9c
modules: create a separate module for errors
pedro-alves-ferreira Jun 22, 2025
b588265
modules: create a separate module for the ffi api
pedro-alves-ferreira Jun 22, 2025
62afa6f
modules: create a separate module for the instance
pedro-alves-ferreira Jun 22, 2025
bd23b87
modules: create a separate module for flow information
pedro-alves-ferreira Jun 22, 2025
8ba9a03
modules: create a separate module for the flow reader
pedro-alves-ferreira Jun 22, 2025
b150acc
instance: don't use unwrap.
pedro-alves-ferreira Jun 22, 2025
e606236
instance: don't expose a destroy method as that breaks the invariants
pedro-alves-ferreira Jun 22, 2025
037836e
build: add a build.rs file to expose the mxl build path
pedro-alves-ferreira Jun 22, 2025
0aa4023
build: use mxl headers directly
pedro-alves-ferreira Jun 22, 2025
6f95a73
examples: add basic example
pedro-alves-ferreira Jun 22, 2025
eac3754
reader: decouple lifetime from instance
pedro-alves-ferreira Jun 24, 2025
db1352f
instance: add a destroy function for testing
pedro-alves-ferreira Jun 24, 2025
3d6f53b
reader: consume self on destroy so that the invariants are not broken
pedro-alves-ferreira Jun 24, 2025
90e9133
grain data: don't allocate and copy payload & user data
pedro-alves-ferreira Jun 22, 2025
c245d1f
error: preserve the error code for unknown errors
pedro-alves-ferreira Jun 23, 2025
b44e7e2
layout: rename rust-bindings to rust
pedro-alves-ferreira Jun 24, 2025
9fff1bd
grain data: add OwnedGrainData and conversion from GrainData
pedro-alves-ferreira Jun 24, 2025
6cb07c9
Reflect function name changes in MXL
pac-work Jul 11, 2025
2ec8542
Add basic discrete flow writer Rust wrapper
pac-work Jul 9, 2025
5899fdb
Fix double free on explicit instance destruction in test
pac-work Jul 9, 2025
169ef53
Rename GrainWriter to GrainWriteAccess
pac-work Jul 10, 2025
556f3b6
Change MxlFlowWriter into a factory class for more specific writers
pac-work Jul 10, 2025
536b26e
Add basic continuous flow writer Rust wrapper
pac-work Jul 11, 2025
cd9ad57
Change MxlFlowReader into a factory class for more specific readers
pac-work Jul 17, 2025
d5dc7e2
Add basic continuous flow reader Rust wrapper
pac-work Jul 18, 2025
719f0f8
Convert instance destroy into safe function
pac-work Jul 18, 2025
c59dd49
Allow referencing rust crates without the need to build MXL
pac-work Jul 22, 2025
c0b9b94
Allow instance cloning
pac-work Jul 31, 2025
fc930e7
Implement Send for readers and writers
pac-work Jul 31, 2025
79df003
refactor: re-organise module structure
cwtchan Jul 23, 2025
2469934
Fix warnings reported by the current Rust compiler
pac-work Aug 18, 2025
eb83e4e
Fix warnings reported by the current Clippy
pac-work Aug 18, 2025
f341728
feat: first pass at github actions for rust bindings
cwtchan Aug 1, 2025
0eeea7c
feat: add build options to build neither tests nor tools
cwtchan Aug 13, 2025
2f17350
feat: ignore generated mxl version header file
cwtchan Aug 13, 2025
860470c
feat: add options to not build tools nor tests
cwtchan Aug 14, 2025
c165804
feat: use `cmake` in `build.rs` for `mxl-sys`
cwtchan Aug 14, 2025
0483ebf
refactor: move code for compiling `mxl` with cmake
cwtchan Aug 14, 2025
310b39f
fix: update `build.rs` to build into build dir
cwtchan Aug 15, 2025
801cc68
fix: supply build_dir correctly as path
cwtchan Aug 15, 2025
eb56b87
fix: building the shared library for the rust bindings
cwtchan Aug 15, 2025
b595bf1
fix(rust-workflows): use `-W clippy::pedantic` as per PR feedback
cwtchan Sep 25, 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
143 changes: 143 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Test the rust bindings

on:
pull_request:
workflow_dispatch:
workflow_call: # We would like this to be called by the main job

jobs:
dependencies:
name: Check Rust dependencies
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./rust

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-deps-${{ hashFiles('**/Cargo.toml') }}
restore-keys: ${{ runner.os }}-cargo-deps-
- name: Use Rust stable 1.88
uses: dtolnay/rust-toolchain@1.88.0
- name: Install cargo audit
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-audit
- name: Install cargo outdated
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-outdated
- name: Install cargo udeps
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-udeps
- name: Install cargo deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
- name: Audit dependencies
run: cargo audit -D warnings
- name: Outdated dependencies
run: cargo outdated -d 1 -w --exit-code 1
- name: Install nightly-2025-06-26 # Same date as 1.88 release
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2025-06-26
- name: Unused depedency check
run: cargo udeps --all-targets

lint:
name: Perform Rust linting and documentation
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./rust

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache
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: Use Rust stable 1.88
uses: dtolnay/rust-toolchain@1.88.0
with:
components: rustfmt, clippy
- name: build
run: cargo build --locked
- name: Format
run: cargo fmt -- --check
- name: Docs
run: cargo doc --all-features
env:
RUSTDOCFLAGS: "-D warnings"
- name: Clippy
run: cargo clippy --all-targets -F mxl-not-built -- -D warnings -W clippy::pedantic

tests:
name: Run the tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./rust

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-tests-${{ hashFiles('**/Cargo.toml') }}
restore-keys: ${{ runner.os }}-cargo-tests-
- name: Use Rust stable 1.88
uses: dtolnay/rust-toolchain@1.88.0
with:
components: rustfmt, clippy
- name: build
run: cargo build --locked -F mxl-not-built
- name: Test
run: cargo test --locked -F mxl-not-built
- name: Coverage
run: >
cargo llvm-cov --ignore-filename-regex "build.rs|ffi.rs|(.*)_test.rs"
--lcov --output-path lcov.info
- name: Report Coverage
uses: romeovs/lcov-reporter-action@v0.4.0
if: ${{ github.event_name == 'pull_request' }}
with:
lcov-file: ./lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }}
delete-old-comments: true
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"
}
}
}
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ else()
string(APPEND mxl_VERSION ".0")
endif()

option(BUILD_TESTS "Build the tests" ON)
option(BUILD_TOOLS "Build the tools" ON)

project(mxl
VERSION ${mxl_VERSION}
LANGUAGES CXX C
Expand Down Expand Up @@ -54,8 +57,10 @@ if(APPLE)
endif()

add_subdirectory(lib)
add_subdirectory(tools)
add_subdirectory(utils)
if (BUILD_TOOLS)
add_subdirectory(tools)
endif()

find_package(Doxygen)

Expand Down Expand Up @@ -132,4 +137,4 @@ set(CPACK_PACKAGE_CONTACT "DMF MXL <mxl@ebu.ch>")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")

# Include CPack
include(CPack)
include(CPack)
6 changes: 4 additions & 2 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ target_link_libraries(mxl
# Alias trace to libtrace::libtrace so that this library can be used
# in lieu of a module from the local source tree
add_library(${PROJECT_NAME}::mxl ALIAS mxl)
add_subdirectory(tests)
if (BUILD_TESTS)
add_subdirectory(tests)
endif()

# Install targets
install(TARGETS mxl EXPORT ${PROJECT_NAME}-targets
Expand Down Expand Up @@ -162,4 +164,4 @@ install(EXPORT ${PROJECT_NAME}-targets
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${MXL_CMAKE_CONFIG_DESTINATION}
COMPONENT ${PROJECT_NAME}-dev
)
)
1 change: 1 addition & 0 deletions rust/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cargo.lock -diff
4 changes: 4 additions & 0 deletions rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
.idea
.vscode
target
Loading
Loading