ServerCommunicationConfigRepository

Trait ServerCommunicationConfigRepository 

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

    // Required methods
    fn get(
        &self,
        hostname: String,
    ) -> impl Future<Output = Result<Option<ServerCommunicationConfig>, Self::GetError>>;
    fn save(
        &self,
        hostname: String,
        config: ServerCommunicationConfig,
    ) -> impl Future<Output = Result<(), Self::SaveError>>;
}
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, hostname: String, ) -> impl Future<Output = Result<Option<ServerCommunicationConfig>, Self::GetError>>

Retrieves configuration for a hostname

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

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

Saves configuration for a hostname

Overwrites any existing configuration for this hostname.

§Arguments
  • hostname - The server hostname (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§