foxglove 0.18.0

Foxglove SDK
Documentation
mod capability;
mod client;
mod connection;
mod credentials_provider;
mod gateway;
mod listener;
mod participant;
mod session;

pub use capability::Capability;
pub use client::Client;
pub use gateway::{Gateway, GatewayHandle};
pub use listener::Listener;

use thiserror::Error;

/// An error type for errors generated by this crate.
#[derive(Error, Debug)]
#[non_exhaustive]
#[allow(clippy::enum_variant_names)]
pub enum RemoteAccessError {
    // Note: don't expose livekit error types here, we don't want them to become part of the public API
    /// An error occurred while writing to the stream.
    #[error("Stream error: {0}")]
    StreamError(String),
    #[error("Connection error: {0}")]
    RoomError(String),
    /// An authentication or credential error.
    #[error("Authentication error: {0}")]
    AuthError(String),
    /// An I/O error.
    #[error(transparent)]
    IoError(#[from] std::io::Error),
}

impl From<livekit::StreamError> for RemoteAccessError {
    fn from(error: livekit::StreamError) -> Self {
        match error {
            livekit::StreamError::Io(e) => RemoteAccessError::IoError(e),
            _ => RemoteAccessError::StreamError(error.to_string()),
        }
    }
}

impl From<livekit::RoomError> for RemoteAccessError {
    fn from(error: livekit::RoomError) -> Self {
        RemoteAccessError::RoomError(error.to_string())
    }
}