pub struct SwiftBridgeModule { /* private fields */ }
Expand description
Represents a type definition within an extern "Rust"
module, as well as all of its methods.
ⓘ
#[swift_bridge::bridge]
mod ffi {
extern "Rust" {
type Stack;
fn push(&mut self, val: u8);
fn pop(self: &mut Stack) -> Option<u8>;
fn as_ptr(&self) -> *const u8;
fn len(self: &Stack) -> usize;
fn consume(self);
}
extern "Swift" {
// TODO: Examples
}
}
Implementations§
Source§impl SwiftBridgeModule
impl SwiftBridgeModule
Sourcepub fn generate_swift_code_and_c_header(
&self,
config: CodegenConfig,
) -> SwiftCodeAndCHeader
pub fn generate_swift_code_and_c_header( &self, config: CodegenConfig, ) -> SwiftCodeAndCHeader
Generate the corresponding Swift code and C header for a bridge module.
Source§impl SwiftBridgeModule
impl SwiftBridgeModule
Sourcepub fn set_swift_bridge_path(&mut self, path: Path)
pub fn set_swift_bridge_path(&mut self, path: Path)
Set the path used for swift_bridge
types such as swift_bridge::RustString
.
We set this to crate
when we’re inside of the swift_bridge
crate.
Trait Implementations§
Source§impl Parse for SwiftBridgeModule
impl Parse for SwiftBridgeModule
fn parse(input: ParseStream<'_>) -> Result<Self>
Source§impl ToTokens for SwiftBridgeModule
impl ToTokens for SwiftBridgeModule
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Auto Trait Implementations§
impl Freeze for SwiftBridgeModule
impl RefUnwindSafe for SwiftBridgeModule
impl !Send for SwiftBridgeModule
impl !Sync for SwiftBridgeModule
impl Unpin for SwiftBridgeModule
impl UnwindSafe for SwiftBridgeModule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.