pub struct Service { /* private fields */ }Expand description
Service wrapper for uniffi bindings
Implementations§
Source§impl Service
impl Service
Sourcepub fn inner(&self) -> Arc<SlimService> ⓘ
pub fn inner(&self) -> Arc<SlimService> ⓘ
Get a clone of the inner service Arc for advanced use cases
Source§impl Service
impl Service
Sourcepub fn new_with_config(name: String, config: ServiceConfig) -> Self
pub fn new_with_config(name: String, config: ServiceConfig) -> Self
Create a new Service with configuration
Sourcepub fn config(&self) -> ServiceConfig
pub fn config(&self) -> ServiceConfig
Get the service configuration
Sourcepub async fn run_async(&self) -> Result<(), SlimError>
pub async fn run_async(&self) -> Result<(), SlimError>
Run the service (starts all configured servers and clients)
Sourcepub fn run(&self) -> Result<(), SlimError>
pub fn run(&self) -> Result<(), SlimError>
Run the service (starts all configured servers and clients) - blocking version
Sourcepub async fn shutdown_async(&self) -> Result<(), SlimError>
pub async fn shutdown_async(&self) -> Result<(), SlimError>
Shutdown the service gracefully
Sourcepub fn shutdown(&self) -> Result<(), SlimError>
pub fn shutdown(&self) -> Result<(), SlimError>
Shutdown the service gracefully - blocking version
Sourcepub async fn run_server_async(
&self,
config: ServerConfig,
) -> Result<(), SlimError>
pub async fn run_server_async( &self, config: ServerConfig, ) -> Result<(), SlimError>
Start a server with the given configuration
Sourcepub fn run_server(&self, config: ServerConfig) -> Result<(), SlimError>
pub fn run_server(&self, config: ServerConfig) -> Result<(), SlimError>
Start a server with the given configuration - blocking version
Sourcepub fn stop_server(&self, endpoint: String) -> Result<(), SlimError>
pub fn stop_server(&self, endpoint: String) -> Result<(), SlimError>
Stop a server by endpoint - blocking version
Sourcepub async fn connect_async(
&self,
config: ClientConfig,
) -> Result<u64, SlimError>
pub async fn connect_async( &self, config: ClientConfig, ) -> Result<u64, SlimError>
Connect to a remote endpoint as a client
Sourcepub fn connect(&self, config: ClientConfig) -> Result<u64, SlimError>
pub fn connect(&self, config: ClientConfig) -> Result<u64, SlimError>
Connect to a remote endpoint as a client - blocking version
Sourcepub fn disconnect(&self, conn_id: u64) -> Result<(), SlimError>
pub fn disconnect(&self, conn_id: u64) -> Result<(), SlimError>
Disconnect a client connection by connection ID - blocking version
Sourcepub fn get_connection_id(&self, endpoint: String) -> Option<u64>
pub fn get_connection_id(&self, endpoint: String) -> Option<u64>
Get the connection ID for a given endpoint
Sourcepub async fn create_app_async(
&self,
base_name: Arc<Name>,
identity_provider_config: IdentityProviderConfig,
identity_verifier_config: IdentityVerifierConfig,
) -> Result<Arc<App>, SlimError>
pub async fn create_app_async( &self, base_name: Arc<Name>, identity_provider_config: IdentityProviderConfig, identity_verifier_config: IdentityVerifierConfig, ) -> Result<Arc<App>, SlimError>
Create a new App with authentication configuration (async version)
This method initializes authentication providers/verifiers and creates a App on this service instance.
§Arguments
base_name- The base name for the app (without ID)identity_provider_config- Configuration for proving identity to othersidentity_verifier_config- Configuration for verifying identity of others
§Returns
Ok(Arc<App>)- Successfully created adapterErr(SlimError)- If adapter creation fails
Sourcepub async fn create_app_with_direction_async(
&self,
name: Arc<Name>,
identity_provider_config: IdentityProviderConfig,
identity_verifier_config: IdentityVerifierConfig,
direction: Direction,
) -> Result<Arc<App>, SlimError>
pub async fn create_app_with_direction_async( &self, name: Arc<Name>, identity_provider_config: IdentityProviderConfig, identity_verifier_config: IdentityVerifierConfig, direction: Direction, ) -> Result<Arc<App>, SlimError>
Create a new App with authentication configuration and traffic direction (async version)
This method initializes authentication providers/verifiers and creates an App on this service instance. The direction parameter controls whether the app can send messages, receive messages, both, or neither.
§Arguments
base_name- The base name for the app (without ID)identity_provider_config- Configuration for proving identity to othersidentity_verifier_config- Configuration for verifying identity of othersdirection- Traffic direction: Send, Recv, Bidirectional, or None
§Returns
Ok(Arc<App>)- Successfully created adapterErr(SlimError)- If adapter creation fails
Sourcepub async fn create_app_with_secret_async(
&self,
name: Arc<Name>,
secret: String,
) -> Result<Arc<App>, SlimError>
pub async fn create_app_with_secret_async( &self, name: Arc<Name>, secret: String, ) -> Result<Arc<App>, SlimError>
Create a new App with SharedSecret authentication (async version)
This is a convenience function for creating a SLIM application using SharedSecret authentication on this service instance. This is the async version.
§Arguments
name- The base name for the app (without ID)secret- The shared secret string for authentication
§Returns
Ok(Arc<App>)- Successfully created appErr(SlimError)- If app creation fails
Sourcepub fn create_app(
&self,
base_name: Arc<Name>,
identity_provider_config: IdentityProviderConfig,
identity_verifier_config: IdentityVerifierConfig,
) -> Result<Arc<App>, SlimError>
pub fn create_app( &self, base_name: Arc<Name>, identity_provider_config: IdentityProviderConfig, identity_verifier_config: IdentityVerifierConfig, ) -> Result<Arc<App>, SlimError>
Create a new App with authentication configuration (blocking version)
This method initializes authentication providers/verifiers and creates a App on this service instance. This is a blocking wrapper around create_app_async.
§Arguments
base_name- The base name for the app (without ID)identity_provider_config- Configuration for proving identity to othersidentity_verifier_config- Configuration for verifying identity of others
§Returns
Ok(Arc<App>)- Successfully created adapterErr(SlimError)- If adapter creation fails
Sourcepub fn create_app_with_direction(
&self,
base_name: Arc<Name>,
identity_provider_config: IdentityProviderConfig,
identity_verifier_config: IdentityVerifierConfig,
direction: Direction,
) -> Result<Arc<App>, SlimError>
pub fn create_app_with_direction( &self, base_name: Arc<Name>, identity_provider_config: IdentityProviderConfig, identity_verifier_config: IdentityVerifierConfig, direction: Direction, ) -> Result<Arc<App>, SlimError>
Create a new App with authentication configuration and traffic direction (blocking version)
This method initializes authentication providers/verifiers and creates an App on this service instance. The direction parameter controls whether the app can send messages, receive messages, both, or neither.
§Arguments
base_name- The base name for the app (without ID)identity_provider_config- Configuration for proving identity to othersidentity_verifier_config- Configuration for verifying identity of othersdirection- Traffic direction: Send, Recv, Bidirectional, or None
§Returns
Ok(Arc<App>)- Successfully created adapterErr(SlimError)- If adapter creation fails
Sourcepub fn create_app_with_secret(
&self,
name: Arc<Name>,
secret: String,
) -> Result<Arc<App>, SlimError>
pub fn create_app_with_secret( &self, name: Arc<Name>, secret: String, ) -> Result<Arc<App>, SlimError>
Create a new App with SharedSecret authentication (helper function)
This is a convenience function for creating a SLIM application using SharedSecret authentication on this service instance.
§Arguments
name- The base name for the app (without ID)secret- The shared secret string for authentication
§Returns
Ok(Arc<App>)- Successfully created appErr(SlimError)- If app creation fails
Trait Implementations§
Source§impl From<Service> for Service
Conversion traits
impl From<Service> for Service
Conversion traits
Source§fn from(service: SlimService) -> Self
fn from(service: SlimService) -> Self
Source§impl<UT> LowerError<UT> for Service
impl<UT> LowerError<UT> for Service
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for Service
impl<UT> LowerReturn<UT> for Service
Source§type ReturnType = <Arc<Service> as LowerReturn<UniFfiTag>>::ReturnType
type ReturnType = <Arc<Service> as LowerReturn<UniFfiTag>>::ReturnType
Source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
Source§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Auto Trait Implementations§
impl Freeze for Service
impl !RefUnwindSafe for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl UnsafeUnpin for Service
impl !UnwindSafe for Service
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request