[vlc-devel] [RFC Patch v2 1/2] libvlc: Add Rust API for writing modules in rust
Steve Lhomme
robux4 at ycbcr.xyz
Mon Sep 14 08:07:59 CEST 2020
On 2020-09-11 21:33, Kartik Ohri wrote:
> The API is written in two layers. vlccore-sys
> crate contains one to one bindings of libvlc
> functions. vlccore-rs crate wraps vlccore-sys and
> exposes a Rust idiomatic API for writing modules
> in rust. As of now, the API exposes only a subset
> of the vlc_stream API. More functionality can be
> added to Rust API as required in the future.
> ---
> .gitignore | 2 +-
> configure.ac | 13 ++++
> src/vlccore-rs/Cargo.toml | 10 +++
> src/vlccore-rs/src/lib.rs | 1 +
> src/vlccore-rs/src/stream.rs | 120 ++++++++++++++++++++++++++++++++++
> src/vlccore-sys/Cargo.toml | 10 +++
> src/vlccore-sys/src/lib.rs | 2 +
> src/vlccore-sys/src/stream.rs | 24 +++++++
> 8 files changed, 181 insertions(+), 1 deletion(-)
> create mode 100644 src/vlccore-rs/Cargo.toml
> create mode 100644 src/vlccore-rs/src/lib.rs
> create mode 100644 src/vlccore-rs/src/stream.rs
> create mode 100644 src/vlccore-sys/Cargo.toml
> create mode 100644 src/vlccore-sys/src/lib.rs
> create mode 100644 src/vlccore-sys/src/stream.rs
>
> diff --git a/.gitignore b/.gitignore
> index fc368212c8..6c049a80b1 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -46,7 +46,7 @@ wxvlc
> vlc_install_dir/*
> plugins.dat
> patches/*
> -
> +**/Cargo.lock
> include/vlc/libvlc_version.h
>
> # Ignore build dirs
> diff --git a/configure.ac b/configure.ac
> index 99e4669942..53d56a725c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1896,6 +1896,19 @@ AS_IF([test "${enable_sout}" != "no"], [
> ])
> AM_CONDITIONAL([ENABLE_SOUT], [test "${enable_sout}" != "no"])
>
> +dnl Rust Modules
> +AC_ARG_ENABLE([rust],
> + AS_HELP_STRING([--enable-rust], [enable building Rust modules (default disabled)]))
> +AS_IF([test "${enable_rust}" = "yes"],
> + [AC_DEFINE(ENABLE_RUST, 1, [Define to 1 for building rust modules.])])
> +AM_CONDITIONAL([BUILD_RUST], [test "${enable_rust}" = "yes"])
You should only set to true this if cargo is available.
> +if test "${enable_rust}" = "yes"
> +then
> + AC_CHECK_PROG(CARGO, [cargo], [yes], [no])
> + AS_IF([test "x$CARGO" = "xno"],
> + AC_MSG_ERROR([cargo not found. cargo is required to build rust modules]))
> +fi
More information about the vlc-devel
mailing list