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 FromWasm for SdkRandomNumberClient
Available on crate feature wasm only.
impl FromWasm for SdkRandomNumberClient
Available on crate feature
wasm only.Source§impl FromWasmAbi for SdkRandomNumberClient
impl FromWasmAbi for SdkRandomNumberClient
Source§impl IntoWasmAbi for SdkRandomNumberClient
impl IntoWasmAbi for SdkRandomNumberClient
Source§type Abi = WasmPtr<WasmRefCell<SdkRandomNumberClient>>
type Abi = WasmPtr<WasmRefCell<SdkRandomNumberClient>>
The Wasm ABI type that this converts into when crossing the ABI
boundary.
Source§impl<UT> LiftRef<UT> for SdkRandomNumberClient
impl<UT> LiftRef<UT> for SdkRandomNumberClient
type LiftType = Arc<SdkRandomNumberClient>
Source§impl LongRefFromWasmAbi for SdkRandomNumberClient
impl LongRefFromWasmAbi for SdkRandomNumberClient
Source§type Abi = WasmPtr<WasmRefCell<SdkRandomNumberClient>>
type Abi = WasmPtr<WasmRefCell<SdkRandomNumberClient>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRef<SdkRandomNumberClient>
type Anchor = RcRef<SdkRandomNumberClient>
Same as
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
Same as
RefFromWasmAbi::ref_from_abiSource§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 Abi = WasmPtr<WasmRefCell<SdkRandomNumberClient>>
type Abi = WasmPtr<WasmRefCell<SdkRandomNumberClient>>
The Wasm ABI type references to
Self are recovered from.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 RefMutFromWasmAbi for SdkRandomNumberClient
impl RefMutFromWasmAbi for SdkRandomNumberClient
Source§type Abi = WasmPtr<WasmRefCell<SdkRandomNumberClient>>
type Abi = WasmPtr<WasmRefCell<SdkRandomNumberClient>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<SdkRandomNumberClient>
type Anchor = RcRefMut<SdkRandomNumberClient>
Same as
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
Same as
RefFromWasmAbi::ref_from_abiimpl SupportsConstructor for SdkRandomNumberClient
impl SupportsInstanceProperty for SdkRandomNumberClient
impl SupportsStaticProperty for SdkRandomNumberClient
Source§impl ToWasm for SdkRandomNumberClient
Available on crate feature wasm only.
impl ToWasm for SdkRandomNumberClient
Available on crate feature
wasm only.Source§impl TryFromJsValue for SdkRandomNumberClient
impl TryFromJsValue for SdkRandomNumberClient
Source§fn try_from_js_value_ref(value: &JsValue) -> Option<Self>
fn try_from_js_value_ref(value: &JsValue) -> Option<Self>
Performs the conversion.
Source§const NULLABLE: bool = false
const NULLABLE: bool = false
Whether
Self accepts null as a distinct value space, as
Nullable<T> does. An enclosing Option then passes null through
instead of reading it as None, so Option<T> is itself nullable
exactly when T is not. JsValue does not set this: it accepts
null as one value among all of them, not as a distinct space, and
Option<JsValue> reads it as None like the ABI does. This is the
JS-value side of NullableFromWasmAbi, which claims null at the
ABI.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
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§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> MaybeFromWasmAbi for Twhere
T: OptionFromWasmAbi,
impl<T> MaybeFromWasmAbi for Twhere
T: OptionFromWasmAbi,
Source§type MaybeAbi = <T as FromWasmAbi>::Abi
type MaybeAbi = <T as FromWasmAbi>::Abi
The ABI of
Option<Self>.Source§unsafe fn from_maybe_abi(js: <T as FromWasmAbi>::Abi) -> T
unsafe fn from_maybe_abi(js: <T as FromWasmAbi>::Abi) -> T
unsafe fn try_from_maybe_abi( js: <T as FromWasmAbi>::Abi, ) -> Result<T, &'static str>
Source§impl<T> MaybeIntoWasmAbi for Twhere
T: OptionIntoWasmAbi,
impl<T> MaybeIntoWasmAbi for Twhere
T: OptionIntoWasmAbi,
Source§type MaybeAbi = <T as IntoWasmAbi>::Abi
type MaybeAbi = <T as IntoWasmAbi>::Abi
The ABI of
Option<Self>.Source§fn into_maybe_abi(self) -> <T as IntoWasmAbi>::Abi
fn into_maybe_abi(self) -> <T as IntoWasmAbi>::Abi
Converts a value into the
Option<Self> ABI.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§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.