alef 0.24.13

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// Rust-side wrapper around a Swift class implementing the `{{ trait_name }}` protocol.
///
/// The Swift instance is held via a `swift-bridge` opaque handle that retains
/// the underlying ARC reference for the lifetime of this struct. Send + Sync are
/// asserted unsafely: Swift classes used as trait bridges must be thread-safe.
pub struct {{ wrapper_name }} {
    inner: ffi::{{ box_name }},
}
unsafe impl Send for {{ wrapper_name }} {}
unsafe impl Sync for {{ wrapper_name }} {}

impl {{ wrapper_name }} {
    /// Construct a new wrapper from a Swift `{{ box_name }}` handle.
    pub fn new(inner: ffi::{{ box_name }}) -> Self {
        Self { inner }
    }
}