Skip to main content

TapSdk

Struct TapSdk 

Source
pub struct TapSdk { /* private fields */ }
Expand description

Main TapTap PC SDK wrapper

This struct represents an initialized SDK instance. Only one instance can exist at a time. When dropped, it will shut down the SDK.

Implementations§

Source§

impl TapSdk

Source

pub fn init(pub_key: &str) -> Result<Self>

Initialize the TapTap PC SDK

§Arguments
  • pub_key - The public key from TapTap developer center
§Returns

A TapSdk instance on success, or an error if initialization failed

§Example
use tapsdk_pc::TapSdk;

let sdk = TapSdk::init("your_public_key_here").expect("Failed to init SDK");
Source

pub fn get_client_id(&self) -> Option<String>

Get the client ID

§Returns

The client ID string, or None if not available

Source

pub fn run_callbacks(&self) -> Vec<TapEvent>

Poll for events from the SDK

This should be called regularly (e.g., in your game loop) to process pending callbacks and receive events.

§Returns

A vector of events that have occurred since the last poll

Source

pub fn shutdown(self)

Shut down the SDK

This is called automatically when the TapSdk instance is dropped, but can be called explicitly if needed.

Trait Implementations§

Source§

impl Debug for TapSdk

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for TapSdk

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for TapSdk

§

impl RefUnwindSafe for TapSdk

§

impl Send for TapSdk

§

impl Sync for TapSdk

§

impl Unpin for TapSdk

§

impl UnwindSafe for TapSdk

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.