Struct cw_controllers::Admin
source · pub struct Admin<'a>(/* private fields */);
Implementations§
source§impl<'a> Admin<'a>
impl<'a> Admin<'a>
pub const fn new(namespace: &'a str) -> Self
pub fn set<Q: CustomQuery>( &self, deps: DepsMut<'_, Q>, admin: Option<Addr> ) -> StdResult<()>
pub fn get<Q: CustomQuery>(&self, deps: Deps<'_, Q>) -> StdResult<Option<Addr>>
sourcepub fn is_admin<Q: CustomQuery>(
&self,
deps: Deps<'_, Q>,
caller: &Addr
) -> StdResult<bool>
pub fn is_admin<Q: CustomQuery>( &self, deps: Deps<'_, Q>, caller: &Addr ) -> StdResult<bool>
Returns Ok(true) if this is an admin, Ok(false) if not and an Error if we hit an error with Api or Storage usage
sourcepub fn assert_admin<Q: CustomQuery>(
&self,
deps: Deps<'_, Q>,
caller: &Addr
) -> Result<(), AdminError>
pub fn assert_admin<Q: CustomQuery>( &self, deps: Deps<'_, Q>, caller: &Addr ) -> Result<(), AdminError>
Like is_admin but returns AdminError::NotAdmin if not admin. Helper for a nice one-line auth check.
pub fn execute_update_admin<C, Q: CustomQuery>( &self, deps: DepsMut<'_, Q>, info: MessageInfo, new_admin: Option<Addr> ) -> Result<Response<C>, AdminError>
pub fn query_admin<Q: CustomQuery>( &self, deps: Deps<'_, Q> ) -> StdResult<AdminResponse>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Admin<'a>
impl<'a> Send for Admin<'a>
impl<'a> Sync for Admin<'a>
impl<'a> Unpin for Admin<'a>
impl<'a> UnwindSafe for Admin<'a>
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
Casts
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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