Trait swift_rs::SwiftArg

source ·
pub trait SwiftArg<'a> {
    type ArgType;

    // Required method
    unsafe fn as_arg(&'a self) -> Self::ArgType;
}
Expand description

Identifies a type as being a valid argument in a Swift function.

Required Associated Types§

Required Methods§

source

unsafe fn as_arg(&'a self) -> Self::ArgType

Creates a swift-compatible version of the argument. For primitives this just returns self, but for SwiftObject types it wraps them in SwiftRef.

This function is called within the swift! macro.

§Safety

Creating a SwiftRef is inherently unsafe, but is reliable if using the swift! macro, so it is not advised to call this function manually.

Implementations on Foreign Types§

source§

impl<'a> SwiftArg<'a> for *const c_void

§

type ArgType = *const c_void

source§

unsafe fn as_arg(&'a self) -> Self::ArgType

source§

impl<'a> SwiftArg<'a> for *const u8

§

type ArgType = *const u8

source§

unsafe fn as_arg(&'a self) -> Self::ArgType

source§

impl<'a> SwiftArg<'a> for *mut c_void

§

type ArgType = *mut c_void

source§

unsafe fn as_arg(&'a self) -> Self::ArgType

source§

impl<'a> SwiftArg<'a> for ()

§

type ArgType = ()

source§

unsafe fn as_arg(&'a self) -> Self::ArgType

source§

impl<'a, T: SwiftArg<'a>> SwiftArg<'a> for &T

§

type ArgType = <T as SwiftArg<'a>>::ArgType

source§

unsafe fn as_arg(&'a self) -> Self::ArgType

Implementors§

source§

impl<'a> SwiftArg<'a> for SRData

source§

impl<'a> SwiftArg<'a> for SRString

source§

impl<'a> SwiftArg<'a> for Bool

source§

impl<'a> SwiftArg<'a> for Float32

§

type ArgType = f32

source§

impl<'a> SwiftArg<'a> for Float64

§

type ArgType = f64

source§

impl<'a> SwiftArg<'a> for Int8

§

type ArgType = i8

source§

impl<'a> SwiftArg<'a> for Int16

§

type ArgType = i16

source§

impl<'a> SwiftArg<'a> for Int32

§

type ArgType = i32

source§

impl<'a> SwiftArg<'a> for Int64

§

type ArgType = i64

source§

impl<'a> SwiftArg<'a> for Int

source§

impl<'a> SwiftArg<'a> for UInt8

§

type ArgType = u8

source§

impl<'a> SwiftArg<'a> for UInt16

§

type ArgType = u16

source§

impl<'a> SwiftArg<'a> for UInt32

§

type ArgType = u32

source§

impl<'a> SwiftArg<'a> for UInt64

§

type ArgType = u64

source§

impl<'a> SwiftArg<'a> for UInt

source§

impl<'a, T: 'a> SwiftArg<'a> for SRArray<T>

§

type ArgType = SwiftRef<'a, SRArray<T>>

source§

impl<'a, T: 'a> SwiftArg<'a> for SRObject<T>

§

type ArgType = SwiftRef<'a, SRObject<T>>