pub struct Clasp { /* private fields */ }Expand description
A Clasp client
Implementations§
Source§impl Clasp
impl Clasp
Sourcepub fn new(
url: &str,
name: String,
features: Vec<String>,
token: Option<String>,
reconnect: bool,
reconnect_interval_ms: u64,
) -> Self
pub fn new( url: &str, name: String, features: Vec<String>, token: Option<String>, reconnect: bool, reconnect_interval_ms: u64, ) -> Self
Create a new client (use builder for more options)
Sourcepub fn builder(url: &str) -> ClaspBuilder
pub fn builder(url: &str) -> ClaspBuilder
Create a builder
Sourcepub async fn connect_to(url: &str) -> Result<Self>
pub async fn connect_to(url: &str) -> Result<Self>
Connect to server (convenience method)
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if connected
Sourcepub fn session_id(&self) -> Option<String>
pub fn session_id(&self) -> Option<String>
Get session ID
Sourcepub async fn subscribe<F>(&self, pattern: &str, callback: F) -> Result<u32>
pub async fn subscribe<F>(&self, pattern: &str, callback: F) -> Result<u32>
Subscribe to an address pattern
Sourcepub async fn unsubscribe(&self, id: u32) -> Result<()>
pub async fn unsubscribe(&self, id: u32) -> Result<()>
Unsubscribe
Sourcepub async fn set(&self, address: &str, value: impl Into<Value>) -> Result<()>
pub async fn set(&self, address: &str, value: impl Into<Value>) -> Result<()>
Set a parameter value
Sourcepub async fn set_locked(
&self,
address: &str,
value: impl Into<Value>,
) -> Result<()>
pub async fn set_locked( &self, address: &str, value: impl Into<Value>, ) -> Result<()>
Set with lock
Sourcepub async fn stream(&self, address: &str, value: impl Into<Value>) -> Result<()>
pub async fn stream(&self, address: &str, value: impl Into<Value>) -> Result<()>
Send stream sample
Auto Trait Implementations§
impl !Freeze for Clasp
impl !RefUnwindSafe for Clasp
impl Send for Clasp
impl Sync for Clasp
impl Unpin for Clasp
impl !UnwindSafe for Clasp
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