Struct lighthouse_client::Lighthouse
source · pub struct Lighthouse<S> { /* private fields */ }Expand description
A connection to the lighthouse server for sending requests and receiving events.
Implementations§
source§impl Lighthouse<TokioWebSocket>
impl Lighthouse<TokioWebSocket>
sourcepub async fn connect_with_tokio_to(
url: &str,
authentication: Authentication
) -> Result<Self>
pub async fn connect_with_tokio_to( url: &str, authentication: Authentication ) -> Result<Self>
Connects to the lighthouse server at the given URL.
sourcepub async fn connect_with_tokio(authentication: Authentication) -> Result<Self>
pub async fn connect_with_tokio(authentication: Authentication) -> Result<Self>
Connects to the lighthouse server at the default URL.
source§impl<S> Lighthouse<S>
impl<S> Lighthouse<S>
sourcepub fn new<W>(web_socket: S, authentication: Authentication) -> Result<Self>where
W: Spawner,
pub fn new<W>(web_socket: S, authentication: Authentication) -> Result<Self>where
W: Spawner,
Connects to the lighthouse using the given credentials. Asynchronously runs a receive loop using the provided spawner.
sourcepub async fn put_model(&mut self, frame: Frame) -> Result<()>
pub async fn put_model(&mut self, frame: Frame) -> Result<()>
Replaces the user’s lighthouse model with the given frame.
sourcepub async fn stream_model(&mut self) -> Result<Receiver<ServerMessage>>
pub async fn stream_model(&mut self) -> Result<Receiver<ServerMessage>>
Requests a stream of events (including key/controller events) for the user’s lighthouse model.
sourcepub async fn put(
&mut self,
path: impl IntoIterator<Item = &str> + Debug,
payload: Payload
) -> Result<()>
pub async fn put( &mut self, path: impl IntoIterator<Item = &str> + Debug, payload: Payload ) -> Result<()>
Performs a PUT request to the given path with the given payload.
sourcepub async fn perform(
&mut self,
verb: &str,
path: impl IntoIterator<Item = &str> + Debug,
payload: Payload
) -> Result<()>
pub async fn perform( &mut self, verb: &str, path: impl IntoIterator<Item = &str> + Debug, payload: Payload ) -> Result<()>
Performs a single request to the given path with the given payload.
sourcepub async fn stream(
&mut self,
path: impl IntoIterator<Item = &str> + Debug,
payload: Payload
) -> Result<Receiver<ServerMessage>>
pub async fn stream( &mut self, path: impl IntoIterator<Item = &str> + Debug, payload: Payload ) -> Result<Receiver<ServerMessage>>
Performs a STREAM request to the given path with the given payload.
Auto Trait Implementations§
impl<S> Freeze for Lighthouse<S>
impl<S> !RefUnwindSafe for Lighthouse<S>
impl<S> Send for Lighthouse<S>where
S: Send,
impl<S> Sync for Lighthouse<S>where
S: Send,
impl<S> Unpin for Lighthouse<S>
impl<S> !UnwindSafe for Lighthouse<S>
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