Skip to main content

WaapiClient

Struct WaapiClient 

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

Async WAAPI client.

Provides async access to the Wwise Authoring API (WAAPI); can be shared across tasks (internal Arc).

It is recommended to call disconnect explicitly for graceful shutdown.


WAAPI 异步客户端。

建议显式调用 disconnect 以确保优雅关闭。

Implementations§

Source§

impl WaapiClient

Source

pub async fn connect() -> Result<Self, WaapiError>

Connect to WAAPI using the default URL.

Connects to ws://localhost:8080/waapi with the default realm.


使用默认 URL 连接到 WAAPI。

Source

pub async fn connect_with_url(url: &str) -> Result<Self, WaapiError>

Connect to WAAPI at the specified URL.


使用指定 URL 连接到 WAAPI。

Source

pub async fn call( &self, uri: &str, args: Option<Value>, options: Option<Value>, ) -> Result<Option<Value>, WaapiError>

Call a WAAPI method.

§Parameters
  • uri - URI of the WAAPI method, e.g. "ak.wwise.core.getInfo" or ak::wwise::core::GET_INFO
  • args - Optional keyword arguments (serde_json::Value, e.g. json!({...}))
  • options - Optional options dict (serde_json::Value)

Returns Option<Value>: WAAPI response as JSON; None when no result.


调用 WAAPI 方法。

返回 Option<Value>:WAAPI 响应的 JSON 值;无结果时为 None

Source

pub async fn subscribe<F>( &self, topic: &str, options: Option<Value>, callback: F, ) -> Result<SubscriptionHandle, WaapiError>
where F: Fn(Option<Value>) + Send + Sync + 'static,

Subscribe to a topic with a callback.

The callback runs in a dedicated task with signature callback(kwargs). The returned handle is used to cancel; on drop it auto-unsubscribes.

§Parameters
  • topic - WAMP topic URI
  • options - Optional subscription options (serde_json::Value)
  • callback - Callback invoked on each event with kwargs (Option<Value>)

订阅主题并绑定回调(参数为 Option<Value>)。

Source

pub fn is_connected(&self) -> bool

Check whether the client is still connected.


检查客户端是否仍处于连接状态。

Source

pub async fn disconnect(self)

Explicitly disconnect.

Explicit call is recommended for graceful shutdown.


显式断开连接。推荐显式调用以确保优雅关闭。

Trait Implementations§

Source§

impl Drop for WaapiClient

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V