Skip to main content

ServerCommunicationConfigRepository

Trait ServerCommunicationConfigRepository 

Source
pub trait ServerCommunicationConfigRepository: Send + Sync {
    type GetError: Debug + Send + Sync + 'static;
    type SaveError: Debug + Send + Sync + 'static;

    // Required methods
    fn get(
        &self,
        domain: String,
    ) -> impl Future<Output = Result<Option<ServerCommunicationConfig>, Self::GetError>> + Send;
    fn save(
        &self,
        domain: String,
        config: ServerCommunicationConfig,
    ) -> impl Future<Output = Result<(), Self::SaveError>> + Send;
}
Expand description

Repository for storing server communication configuration

This trait abstracts storage to allow TypeScript implementations via State Provider in WASM contexts, while also supporting in-memory implementations for testing.

Required Associated Types§

Source

type GetError: Debug + Send + Sync + 'static

Error type returned by get() operations

Source

type SaveError: Debug + Send + Sync + 'static

Error type returned by save() operations

Required Methods§

Source

fn get( &self, domain: String, ) -> impl Future<Output = Result<Option<ServerCommunicationConfig>, Self::GetError>> + Send

Retrieves configuration for a domain

§Arguments
  • domain - The server domain (e.g., “vault.amazon.com”)
§Returns
  • Ok(Some(config)) - Configuration exists for this domain
  • Ok(None) - No configuration exists (not an error)
  • Err(e) - Storage operation failed
Source

fn save( &self, domain: String, config: ServerCommunicationConfig, ) -> impl Future<Output = Result<(), Self::SaveError>> + Send

Saves configuration for a domain

Overwrites any existing configuration for this domain.

§Arguments
  • domain - The server domain (e.g., “vault.amazon.com”)
  • config - The configuration to store
§Returns
  • Ok(()) - Configuration saved successfully
  • Err(e) - Storage operation failed

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§