pub struct Client { /* private fields */ }Expand description
Session against one deployed relay.
The credential is per-client, not process-global. Two clients in the same process may use different keys.
Implementations§
Source§impl Client
impl Client
pub fn new(config: ClientConfig) -> Result<Self>
Sourcepub fn from_credential(
server: impl Into<String>,
credential: Credential,
keep_alive: bool,
namespace: Option<u64>,
) -> Self
pub fn from_credential( server: impl Into<String>, credential: Credential, keep_alive: bool, namespace: Option<u64>, ) -> Self
Build a client from an already-parsed credential.
pub fn server(&self) -> &str
pub fn namespace(&self) -> Option<u64>
Sourcepub fn admin(&self) -> Result<Admin>
pub fn admin(&self) -> Result<Admin>
Administrator RPCs. Fails locally when the session is not an admin key.
Sourcepub async fn register(&self, request: RegisterRequest) -> Result<Registration>
pub async fn register(&self, request: RegisterRequest) -> Result<Registration>
Publish a local service on the relay under request.key.
Returns as soon as the worker is spawned; the handle’s
Registration::wait_ready is what waits for the relay to accept it.
Sourcepub async fn connect(&self, request: ConnectRequest) -> Result<Connection>
pub async fn connect(&self, request: ConnectRequest) -> Result<Connection>
Subscribe to a registered service and forward it from a local listener.
Returns as soon as the worker is spawned; the handle’s
Connection::wait_ready is what waits for the local listener to bind
and the relay to confirm the service.
Sourcepub async fn list_keys(&self) -> Result<Vec<String>>
pub async fn list_keys(&self) -> Result<Vec<String>>
Service keys visible to this credential’s namespace.
pub async fn service_status( &self, key: impl Into<String>, ) -> Result<Vec<ServiceConnection>>
pub async fn remote_id(&self) -> Result<RemoteId>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl UnwindSafe for Client
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more