Skip to main content

Service

Struct Service 

Source
pub struct Service { /* private fields */ }
Expand description

Service wrapper for uniffi bindings

Implementations§

Source§

impl Service

Source

pub fn inner(&self) -> Arc<SlimService>

Get a clone of the inner service Arc for advanced use cases

Source§

impl Service

Source

pub fn new(name: String) -> Self

Create a new Service with the given name

Source

pub fn new_with_config(name: String, config: ServiceConfig) -> Self

Create a new Service with configuration

Source

pub fn config(&self) -> ServiceConfig

Get the service configuration

Source

pub fn get_name(&self) -> String

Get the service identifier/name

Source

pub async fn run_async(&self) -> Result<(), SlimError>

Run the service (starts all configured servers and clients)

Source

pub fn run(&self) -> Result<(), SlimError>

Run the service (starts all configured servers and clients) - blocking version

Source

pub async fn shutdown_async(&self) -> Result<(), SlimError>

Shutdown the service gracefully

Source

pub fn shutdown(&self) -> Result<(), SlimError>

Shutdown the service gracefully - blocking version

Source

pub async fn run_server_async( &self, config: ServerConfig, ) -> Result<(), SlimError>

Start a server with the given configuration

Source

pub fn run_server(&self, config: ServerConfig) -> Result<(), SlimError>

Start a server with the given configuration - blocking version

Source

pub fn stop_server(&self, endpoint: String) -> Result<(), SlimError>

Stop a server by endpoint - blocking version

Source

pub async fn connect_async( &self, config: ClientConfig, ) -> Result<u64, SlimError>

Connect to a remote endpoint as a client

Source

pub fn connect(&self, config: ClientConfig) -> Result<u64, SlimError>

Connect to a remote endpoint as a client - blocking version

Source

pub fn disconnect(&self, conn_id: u64) -> Result<(), SlimError>

Disconnect a client connection by connection ID - blocking version

Source

pub fn get_connection_id(&self, endpoint: String) -> Option<u64>

Get the connection ID for a given endpoint

Source

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 others
  • identity_verifier_config - Configuration for verifying identity of others
§Returns
  • Ok(Arc<App>) - Successfully created adapter
  • Err(SlimError) - If adapter creation fails
Source

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 others
  • identity_verifier_config - Configuration for verifying identity of others
  • direction - Traffic direction: Send, Recv, Bidirectional, or None
§Returns
  • Ok(Arc<App>) - Successfully created adapter
  • Err(SlimError) - If adapter creation fails
Source

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 app
  • Err(SlimError) - If app creation fails
Source

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 others
  • identity_verifier_config - Configuration for verifying identity of others
§Returns
  • Ok(Arc<App>) - Successfully created adapter
  • Err(SlimError) - If adapter creation fails
Source

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 others
  • identity_verifier_config - Configuration for verifying identity of others
  • direction - Traffic direction: Send, Recv, Bidirectional, or None
§Returns
  • Ok(Arc<App>) - Successfully created adapter
  • Err(SlimError) - If adapter creation fails
Source

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 app
  • Err(SlimError) - If app creation fails

Trait Implementations§

Source§

impl From<Service> for Service

Conversion traits

Source§

fn from(service: SlimService) -> Self

Converts to this type from the input type.
Source§

impl<UT> LiftRef<UT> for Service

Source§

impl<UT> LowerError<UT> for Service

Source§

fn lower_error(obj: Self) -> RustBuffer

Lower this value for scaffolding function return Read more
Source§

impl<UT> LowerReturn<UT> for Service

Source§

type ReturnType = <Arc<Service> as LowerReturn<UniFfiTag>>::ReturnType

The type that should be returned by scaffolding functions for this type. Read more
Source§

fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>

Lower the return value from an scaffolding call Read more
Source§

fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>

Lower the return value for failed argument lifts Read more
Source§

impl<UT> TypeId<UT> for Service

Auto Trait Implementations§

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

Source§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
Source§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
Source§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
Source§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

Source§

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