pub struct WasmPolicy { /* private fields */ }Expand description
WASM wrapper for Policy
Implementations§
Source§impl WasmPolicy
impl WasmPolicy
Sourcepub fn add_rule(
&mut self,
peer_id: &str,
action: &str,
resource: &str,
) -> Result<(), JsValue>
pub fn add_rule( &mut self, peer_id: &str, action: &str, resource: &str, ) -> Result<(), JsValue>
Add a rule to the policy
Sourcepub fn rule_count(&self) -> usize
pub fn rule_count(&self) -> usize
Get number of rules
Sourcepub fn get_root_hash(&self) -> Result<String, JsValue>
pub fn get_root_hash(&self) -> Result<String, JsValue>
Get the Merkle root hash of the policy
Calculates the hash of the canonical TOML representation of the policy. This serves as the Merkle root for synchronization verification.
Trait Implementations§
Source§impl From<WasmPolicy> for JsValue
impl From<WasmPolicy> for JsValue
Source§fn from(value: WasmPolicy) -> Self
fn from(value: WasmPolicy) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for WasmPolicy
impl FromWasmAbi for WasmPolicy
Source§impl IntoWasmAbi for WasmPolicy
impl IntoWasmAbi for WasmPolicy
Source§impl LongRefFromWasmAbi for WasmPolicy
impl LongRefFromWasmAbi for WasmPolicy
Source§type Abi = WasmPtr<WasmRefCell<WasmPolicy>>
type Abi = WasmPtr<WasmRefCell<WasmPolicy>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRef<WasmPolicy>
type Anchor = RcRef<WasmPolicy>
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 OptionFromWasmAbi for WasmPolicy
impl OptionFromWasmAbi for WasmPolicy
Source§impl OptionIntoWasmAbi for WasmPolicy
impl OptionIntoWasmAbi for WasmPolicy
Source§impl RefFromWasmAbi for WasmPolicy
impl RefFromWasmAbi for WasmPolicy
Source§type Abi = WasmPtr<WasmRefCell<WasmPolicy>>
type Abi = WasmPtr<WasmRefCell<WasmPolicy>>
The Wasm ABI type references to
Self are recovered from.Source§type Anchor = RcRef<WasmPolicy>
type Anchor = RcRef<WasmPolicy>
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 WasmPolicy
impl RefMutFromWasmAbi for WasmPolicy
Source§type Abi = WasmPtr<WasmRefCell<WasmPolicy>>
type Abi = WasmPtr<WasmRefCell<WasmPolicy>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<WasmPolicy>
type Anchor = RcRefMut<WasmPolicy>
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_abiSource§impl TryFromJsValue for WasmPolicy
impl TryFromJsValue for WasmPolicy
Source§impl VectorFromWasmAbi for WasmPolicy
impl VectorFromWasmAbi for WasmPolicy
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[WasmPolicy]>
Source§impl VectorIntoWasmAbi for WasmPolicy
impl VectorIntoWasmAbi for WasmPolicy
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[WasmPolicy]>) -> Self::Abi
Source§impl WasmDescribeVector for WasmPolicy
impl WasmDescribeVector for WasmPolicy
impl SupportsConstructor for WasmPolicy
impl SupportsInstanceProperty for WasmPolicy
impl SupportsStaticProperty for WasmPolicy
Auto Trait Implementations§
impl Freeze for WasmPolicy
impl RefUnwindSafe for WasmPolicy
impl Send for WasmPolicy
impl Sync for WasmPolicy
impl Unpin for WasmPolicy
impl UnsafeUnpin for WasmPolicy
impl UnwindSafe for WasmPolicy
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> 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.