Expand description
§SLIM Bindings - UniFFI Language Bindings
This crate provides language-agnostic FFI bindings for SLIM using UniFFI. It enables integration with Go, Python, Kotlin, Swift, and other languages.
§Architecture
The module is organized into distinct components:
App: App-level operations (creation, configuration, session management)Session: Session-specific operations (publish, invite, remove, message reception)MessageContext: Message metadata and routing informationServiceRef: Service reference management (global vs local)
§Usage
§From Rust
ⓘ
use slim_bindings::{App, Name, SessionConfig, SessionType, IdentityProviderConfig, IdentityVerifierConfig};
// Create an app
let app_name = Arc::new(Name { components: vec!["org".into(), "app".into(), "v1".into()], id: None });
let provider_config = IdentityProviderConfig::SharedSecret { data: "my-secret".to_string() };
let verifier_config = IdentityVerifierConfig::SharedSecret { data: "my-secret".to_string() };
let app = App::new(app_name, provider_config, verifier_config, false)?;
// Create a session
let config = SessionConfig { session_type: SessionType::PointToPoint, ... };
let session = app.create_session(config, destination)?;§From Go (via generated bindings)
providerConfig := slim.IdentityProviderConfigSharedSecret{Data: sharedSecret}
verifierConfig := slim.IdentityVerifierConfigSharedSecret{Data: sharedSecret}
app, err := slim.NewApp(appName, providerConfig, verifierConfig, false)
session, err := app.CreateSession(config, destination)
session.Publish(data, payloadType, metadata)Re-exports§
pub use slimrpc::BidiStreamHandler;pub use slimrpc::Channel;pub use slimrpc::Codec;pub use slimrpc::Context;pub use slimrpc::DEADLINE_KEY;pub use slimrpc::DecodedStream;pub use slimrpc::Decoder;pub use slimrpc::Encoder;pub use slimrpc::HandlerType;pub use slimrpc::InvalidRpcCode;pub use slimrpc::MAX_TIMEOUT;pub use slimrpc::MulticastBidiStreamHandler;pub use slimrpc::MulticastResponseReader;pub use slimrpc::MulticastStreamMessage;pub use slimrpc::RawStream;pub use slimrpc::RequestStreamWriter;pub use slimrpc::ResponseSink;pub use slimrpc::ResponseStreamReader;pub use slimrpc::RpcCode;pub use slimrpc::RpcError;pub use slimrpc::RpcMessageContext;pub use slimrpc::RpcMulticastItem;pub use slimrpc::STATUS_CODE_KEY;pub use slimrpc::Server;pub use slimrpc::SessionContext as RpcSessionContext;pub use slimrpc::StreamMessage;pub use slimrpc::StreamStreamHandler;pub use slimrpc::StreamUnaryHandler;pub use slimrpc::UnaryStreamHandler;pub use slimrpc::UnaryUnaryHandler;pub use slimrpc::UniffiRequestStream as RequestStream;pub use slimrpc::build_method_subscription_name;
Modules§
- slimrpc
- SlimRPC - gRPC-like RPC framework over SLIM
Structs§
- App
- Adapter that bridges the App API with language-bindings interface
- Basic
Auth - Basic authentication configuration
- Build
Info - Build information for the SLIM bindings
- Client
Config - Client configuration for connecting to a SLIM server
- Client
JwtAuth - JWT authentication configuration for client-side signing
- Completion
Handle - FFI-compatible completion handle for async operations
- Dataplane
Config - DataPlane configuration wrapper for uniffi bindings
- Exponential
Backoff - Exponential backoff configuration
- JwtAuth
- JWT authentication configuration for server-side verification
- JwtKey
Config - JWT key configuration
- Keepalive
Config - Keepalive configuration for the client
- Keepalive
Server Parameters - Keepalive configuration for the server
- Message
Context - Generic message context for language bindings (UniFFI-compatible)
- Name
- Name type for SLIM (Secure Low-Latency Interactive Messaging)
- Proxy
Config - HTTP Proxy configuration
- Received
Message - Received message containing context and payload
- Runtime
Config - Runtime configuration for the SLIM bindings
- Server
Config - Server configuration for running a SLIM server
- Service
- Service wrapper for uniffi bindings
- Service
Config - Service configuration wrapper for uniffi bindings
- Session
- Session context for language bindings (UniFFI-compatible)
- Session
Config - Session configuration
- Session
With Completion - Result of creating a session, containing the session context and a completion handle
- Spire
Config - SPIRE configuration for SPIFFE Workload API integration
- Static
JwtAuth - Static JWT (Bearer token) authentication configuration The token is loaded from a file and automatically reloaded when changed
- TlsClient
Config - TLS configuration for client connections
- TlsServer
Config - TLS configuration for server connections
- Tracing
Config - Tracing/logging configuration for the SLIM bindings
Enums§
- Backoff
Config - Backoff retry configuration
- CaSource
- CA certificate source configuration
- Client
Authentication Config - Authentication configuration enum for client
- Client
Transport Protocol - Transport protocol for dataplane communication.
- Direction
- Direction enum Indicates whether the App can send, receive, both, or neither.
- Identity
Provider Config - Identity provider configuration - used to prove identity to others
- Identity
Verifier Config - Identity verifier configuration - used to verify identity of others
- JwtAlgorithm
- JWT signing/verification algorithm
- JwtKey
Data - JWT key data source
- JwtKey
Format - JWT key format
- JwtKey
Type - JWT key type (encoding, decoding, or autoresolve)
- Server
Authentication Config - Authentication configuration enum for server
- Server
Transport Protocol - Transport protocol for dataplane communication.
- Session
Type - Session type enum
- Slim
Error - Error types for SLIM operations
- TlsSource
- TLS certificate and key source configuration
- Transport
Protocol - Transport protocol for dataplane communication.
Functions§
- create_
service - Create a new Service with builder pattern
- create_
service_ with_ config - Create a new Service with configuration
- get_
build_ info - Get detailed build information
- get_
global_ service - Get the global service instance (creates it if it doesn’t exist)
- get_
runtime - Get the global runtime
- get_
runtime_ config - Get the runtime configuration
- get_
service_ config - Get the service configuration
- get_
tracing_ config - Get the tracing configuration
- get_
version - Get the version of the SLIM bindings (simple string)
- initialize_
from_ config - Initialize SLIM bindings from a configuration file
- initialize_
with_ configs - Initialize SLIM bindings with custom configuration structs
- initialize_
with_ defaults - Initialize SLIM bindings with default configuration
- is_
initialized - Check if SLIM bindings have been initialized
- new_
config_ from_ json - Parse and validate a SLIM gRPC client configuration from JSON.
- new_
dataplane_ config - Create a new DataplaneConfig
- new_
insecure_ client_ config - Create a new insecure client config (no TLS)
- new_
insecure_ server_ config - Create a new insecure server config (no TLS)
- new_
runtime_ config - Create a new BindingsRuntimeConfig with default values
- new_
runtime_ config_ with - Create a new BindingsRuntimeConfig with custom values
- new_
server_ config - Create a new server config with the given endpoint and default values
- new_
service_ config - Create a new BindingsServiceConfig with default values
- new_
service_ config_ with - Create a new BindingsServiceConfig with custom values
- new_
service_ configuration - Create a new ServiceConfiguration
- new_
tracing_ config - Create a new BindingsTracingConfig with default values
- new_
tracing_ config_ with - Create a new BindingsTracingConfig with custom values
- shutdown
- Perform graceful shutdown operations
- shutdown_
blocking - Perform graceful shutdown operations (blocking version)