pub struct CustomEntropySource {
pub callback: unsafe extern "C" fn(*mut u8, usize, *mut u8) -> i32,
pub context: EntropyContext,
pub quality: EntropyQuality,
pub config: CustomEntropyConfig,
pub source_id: &'static str,
}Expand description
Custom entropy source registration
This structure manages the registration of custom entropy sources for the current thread.
Fields§
§callback: unsafe extern "C" fn(*mut u8, usize, *mut u8) -> i32Callback function for entropy generation
context: EntropyContextContext data for the callback
quality: EntropyQualityQuality level of this entropy source
config: CustomEntropyConfigConfiguration for this entropy source
source_id: &'static strSource identifier
Implementations§
Source§impl CustomEntropySource
impl CustomEntropySource
Sourcepub const unsafe fn new(
callback: unsafe extern "C" fn(*mut u8, usize, *mut u8) -> i32,
context: EntropyContext,
quality: EntropyQuality,
config: CustomEntropyConfig,
source_id: &'static str,
) -> CustomEntropySource
pub const unsafe fn new( callback: unsafe extern "C" fn(*mut u8, usize, *mut u8) -> i32, context: EntropyContext, quality: EntropyQuality, config: CustomEntropyConfig, source_id: &'static str, ) -> CustomEntropySource
Create a new custom entropy source
§Arguments
callback- Function to call for entropy generationcontext- Context data for the callbackquality- Quality level of this entropy sourceconfig- Configuration for this entropy sourcesource_id- Unique identifier for this source
§Safety
The callback function must be thread-safe and must not cause
undefined behavior. The context.user_data must be valid for
context.size bytes if context.size > 0.
Sourcepub fn callback(&self) -> unsafe extern "C" fn(*mut u8, usize, *mut u8) -> i32
pub fn callback(&self) -> unsafe extern "C" fn(*mut u8, usize, *mut u8) -> i32
Get the callback function
Sourcepub fn context(&self) -> EntropyContext
pub fn context(&self) -> EntropyContext
Get the context data
Sourcepub fn quality(&self) -> EntropyQuality
pub fn quality(&self) -> EntropyQuality
Get the quality level
Sourcepub fn config(&self) -> &CustomEntropyConfig
pub fn config(&self) -> &CustomEntropyConfig
Get the configuration
Trait Implementations§
Source§impl Debug for CustomEntropySource
impl Debug for CustomEntropySource
Auto Trait Implementations§
impl Freeze for CustomEntropySource
impl RefUnwindSafe for CustomEntropySource
impl !Send for CustomEntropySource
impl !Sync for CustomEntropySource
impl Unpin for CustomEntropySource
impl UnsafeUnpin for CustomEntropySource
impl UnwindSafe for CustomEntropySource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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