pub struct SdkRandomNumberClient;Expand description
Client exposing random-number generation to cross-platform bindings.
Implementations§
Source§impl SdkRandomNumberClient
impl SdkRandomNumberClient
Sourcepub fn gen_bytes(&self, len: u32) -> Result<Vec<u8>, GenBytesError>
pub fn gen_bytes(&self, len: u32) -> Result<Vec<u8>, GenBytesError>
Generate len cryptographically-secure random bytes.
Returns GenBytesError::TooManyBytes if len exceeds 1 KiB. If you want over 1KiB of
randomness, please reconsider your design.
Sourcepub fn gen_uuid(&self) -> String
pub fn gen_uuid(&self) -> String
Generate a random v4 UUID, sampled from a CRNG
This has 122 random bits of entropy.
Sourcepub fn gen_range(&self, min: u32, max: u32) -> Result<u32, GenRangeError>
pub fn gen_range(&self, min: u32, max: u32) -> Result<u32, GenRangeError>
Generate a cryptographically-secure random number in the range [min, max] (inclusive).
Returns GenRangeError::InvalidRange if min > max.
Trait Implementations§
Source§impl Default for SdkRandomNumberClient
impl Default for SdkRandomNumberClient
Source§fn default() -> SdkRandomNumberClient
fn default() -> SdkRandomNumberClient
Returns the “default value” for a type. Read more
Source§impl From<SdkRandomNumberClient> for JsValue
impl From<SdkRandomNumberClient> for JsValue
Source§fn from(value: SdkRandomNumberClient) -> Self
fn from(value: SdkRandomNumberClient) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for SdkRandomNumberClient
impl FromWasmAbi for SdkRandomNumberClient
Source§impl IntoWasmAbi for SdkRandomNumberClient
impl IntoWasmAbi for SdkRandomNumberClient
Source§impl<UT> LiftRef<UT> for SdkRandomNumberClient
impl<UT> LiftRef<UT> for SdkRandomNumberClient
type LiftType = Arc<SdkRandomNumberClient>
Source§impl<UT> LowerError<UT> for SdkRandomNumberClient
impl<UT> LowerError<UT> for SdkRandomNumberClient
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Lower this value for scaffolding function return Read more
Source§impl<UT> LowerReturn<UT> for SdkRandomNumberClient
impl<UT> LowerReturn<UT> for SdkRandomNumberClient
Source§type ReturnType = <Arc<SdkRandomNumberClient> as LowerReturn<UniFfiTag>>::ReturnType
type ReturnType = <Arc<SdkRandomNumberClient> as LowerReturn<UniFfiTag>>::ReturnType
The type that should be returned by scaffolding functions for this type. Read more
Source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
Lower the return value from an scaffolding call Read more
§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Lower the return value for failed argument lifts Read more
Source§impl RefFromWasmAbi for SdkRandomNumberClient
impl RefFromWasmAbi for SdkRandomNumberClient
Source§type Anchor = RcRef<SdkRandomNumberClient>
type Anchor = RcRef<SdkRandomNumberClient>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl<UT> TypeId<UT> for SdkRandomNumberClient
impl<UT> TypeId<UT> for SdkRandomNumberClient
const TYPE_ID_META: MetadataBuffer
Source§impl VectorFromWasmAbi for SdkRandomNumberClient
impl VectorFromWasmAbi for SdkRandomNumberClient
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[SdkRandomNumberClient]>
Source§impl VectorIntoWasmAbi for SdkRandomNumberClient
impl VectorIntoWasmAbi for SdkRandomNumberClient
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[SdkRandomNumberClient]>) -> Self::Abi
Source§impl WasmDescribe for SdkRandomNumberClient
impl WasmDescribe for SdkRandomNumberClient
impl SupportsConstructor for SdkRandomNumberClient
impl SupportsInstanceProperty for SdkRandomNumberClient
impl SupportsStaticProperty for SdkRandomNumberClient
Auto Trait Implementations§
impl Freeze for SdkRandomNumberClient
impl RefUnwindSafe for SdkRandomNumberClient
impl Send for SdkRandomNumberClient
impl Sync for SdkRandomNumberClient
impl Unpin for SdkRandomNumberClient
impl UnsafeUnpin for SdkRandomNumberClient
impl UnwindSafe for SdkRandomNumberClient
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<> Read moreSource§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.