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>

source

pub async fn connect_with_tokio_to( url: &str, authentication: Authentication ) -> Result<Self>

Connects to the lighthouse server at the given URL.

source

pub async fn connect_with_tokio(authentication: Authentication) -> Result<Self>

Connects to the lighthouse server at the default URL.

source§

impl<S> Lighthouse<S>
where S: Stream<Item = Result<Message>> + Sink<Message, Error = Error> + Unpin + Send + 'static,

source

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.

source

pub async fn put_model(&mut self, frame: Frame) -> Result<()>

Replaces the user’s lighthouse model with the given frame.

source

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.

source

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.

source

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.

source

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

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more