Skip to main content

RngProvider

Trait RngProvider 

Source
pub trait RngProvider: Send + Sync {
    // Required methods
    fn create_rng(&self, config: &RngConfig) -> Result<Box<dyn SecureRng>>;
    fn name(&self) -> &'static str;
    fn capabilities(&self) -> ProviderCapabilities;

    // Provided methods
    fn supports_config(&self, config: &RngConfig) -> bool { ... }
    fn priority(&self) -> u32 { ... }
}
Expand description

RNG provider trait for creating and managing RNG instances

This trait defines the interface for RNG providers that can create and manage RNG instances with different characteristics.

Required Methods§

Source

fn create_rng(&self, config: &RngConfig) -> Result<Box<dyn SecureRng>>

Create a new RNG instance

§Arguments
  • config - Configuration for the RNG
§Errors

Returns an error if the RNG cannot be created.

Source

fn name(&self) -> &'static str

Get the provider’s name

Returns a human-readable name for the provider.

Source

fn capabilities(&self) -> ProviderCapabilities

Get the provider’s capabilities

Returns the capabilities of the provider.

Provided Methods§

Source

fn supports_config(&self, config: &RngConfig) -> bool

Check if the provider supports a specific configuration

§Arguments
  • config - Configuration to check

Returns true if the provider supports the configuration.

Source

fn priority(&self) -> u32

Get the provider’s priority

Returns a priority value for the provider, where higher values indicate higher priority.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl RngProvider for LibQRngProvider

Available on crate feature alloc only.