Struct cw_controllers::Admin
source · [−]pub struct Admin<'a>(_);
Implementations
sourceimpl<'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> where
C: Clone + Debug + PartialEq + JsonSchema,
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more