adguard-flm-ffi

Crates.ioadguard-flm-ffi
lib.rsadguard-flm-ffi
version0.8.17
sourcesrc
created_at2024-08-28 14:02:59.463656
updated_at2024-11-07 16:42:18.874932
descriptionForeign function interface crate for filter list manager library
homepagehttps://adguard.com
repositoryhttps://github.com/AdguardTeam/FilterListManager
max_upload_size
id1354689
size63,110
(adguard)

documentation

README

FFI for AdGuard FLM

Foreign function interface crate for filter list manager library.

For generating FFI bindings, the uniffi-rs library is used.

Build

Apple

rustup target add x86_64-apple-darwin aarch64-apple-darwin # for macOS universal framework
rustup target add x86_64-apple-ios aarch64-apple-ios-sim # for iPhone simulator universal framework
rustup target add aarch64-apple-ios # for iOS framework

Building Apple XCFramework

cd ${REPO_ROOT}
./platform/apple/build.sh

Windows

tbd...

Usage recommendations and motivation

This crate is a set of bindings over filter-list-manager and build configurations for FFI bindings to interface with other programming languages. Currently, the FFI wrapper uses a Mutex wrapper around FLM, keep this in mind.

For example:

  1. You want to update filters with update_filters method.
  2. Client has bad internet connection, and we have a lot of filters.
  3. You run filters update process in another thread in your app.
  4. The main thread wants to read something from FLM.
  5. Main thread will be blocked until update process will be completed.

Specifically for this case, the solution will be to use the second parameter of the update_filters method - loose_timeout.

FFI-specific symbols

Look at these symbols for better understanding FFI interface.

Functions

Top Level Functions

Models

Models

Errors

OuterError - flattened enum from adguard_flm::FLMError. Outer Error

Commit count: 111

cargo fmt