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
sourceimpl<S> Lighthouse<S>where
S: Stream<Item = Result<Message>> + Sink<Message, Error = Error> + Unpin + Send + 'static,
impl<S> Lighthouse<S>where
S: Stream<Item = Result<Message>> + Sink<Message, Error = Error> + Unpin + Send + 'static,
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 request(
&mut self,
verb: &str,
path: impl IntoIterator<Item = &str> + Debug,
payload: Payload
) -> Result<()>
pub async fn request(
&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> !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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more