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<ServerMessage<()>>

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

source

pub async fn stream_model( &mut self ) -> Result<impl Stream<Item = Result<ServerMessage<Model>>>>

Requests a stream of events (including key/controller events) for the user’s lighthouse model.

source

pub async fn get_laser_metrics(&mut self) -> Result<ServerMessage<LaserMetrics>>

Fetches lamp server metrics.

source

pub async fn post<P>( &mut self, path: &[&str], payload: P ) -> Result<ServerMessage<Value>>
where P: Serialize,

Combines PUT and CREATE. Requires CREATE and WRITE permission.

source

pub async fn put<P>( &mut self, path: &[&str], payload: P ) -> Result<ServerMessage<()>>
where P: Serialize,

Updates the resource at the given path with the given payload. Requires WRITE permission.

source

pub async fn create(&mut self, path: &[&str]) -> Result<ServerMessage<Value>>

Creates a resource at the given path. Requires CREATE permission.

source

pub async fn delete(&mut self, path: &[&str]) -> Result<ServerMessage<Value>>

Deletes a resource at the given path. Requires DELETE permission.

source

pub async fn mkdir(&mut self, path: &[&str]) -> Result<ServerMessage<Value>>

Creates a directory at the given path. Requires CREATE permission.

source

pub async fn list( &mut self, path: &[&str] ) -> Result<ServerMessage<DirectoryTree>>

Lists the directory tree at the given path. Requires READ permission.

source

pub async fn get<R>(&mut self, path: &[&str]) -> Result<ServerMessage<R>>
where R: for<'de> Deserialize<'de>,

Gets the resource at the given path. Requires READ permission.

source

pub async fn perform<P, R>( &mut self, verb: &Verb, path: &[&str], payload: P ) -> Result<ServerMessage<R>>
where P: Serialize, R: for<'de> Deserialize<'de>,

Performs a single request to the given path with the given payload.

source

pub async fn stream<P, R>( &mut self, path: &[&str], payload: P ) -> Result<impl Stream<Item = Result<ServerMessage<R>>>>
where P: Serialize, R: for<'de> Deserialize<'de>,

Performs a STREAM request to the given path with the given payload.

source

pub fn authentication(&self) -> &Authentication

Fetches the credentials used to authenticate with the lighthouse.

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